Android Question problem with gps example: current location not marked

toby

Well-Known Member
Licensed User
Longtime User
I started with the tutorial example: Google map with FusedLocationProvider

After setting google map api key, I ran it as it is. My current location wouldn't be shown and marked until I manually press the gps location icon. There are at least 3 errors in the logs which might or might not be related.

Could someone give me some hints, please?

Logs:
 
Last edited:

toby

Well-Known Member
Licensed User
Longtime User
@Erel. Because I want to detect and show the phone's current location on the map, so I need Fused Location Provider.
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
@Erel, That's exactly what I did by starting with your example.

With tips from @DonManfred in another thread, I've came out with the following solution:
1. sub CenterizeMap() is added to Main activity:

B4X:
public Sub CenterizeMap
    If lastLocation.IsInitialized Then
        gmap.AddMarker(lastLocation.Latitude,lastLocation.Longitude, "test")
        Dim cp As CameraPosition
        cp.Initialize (lastLocation.Latitude, lastLocation.Longitude, 15)
        gmap.AnimateCamera(cp)
    End If
 
End Sub

2. In the location changed event, save the location info and call the above sub.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…