hi,
when my application open, it show a google map, with 'my location' button, but user have to press 'my location' button to move the map.
question, How do I zoom in automatically to the current location in Google Maps when loading a google map ?
i try, but lat and long always 0
i also use https://www.b4x.com/android/forum/threads/background-location-tracking.99873/
thank you for your help
when my application open, it show a google map, with 'my location' button, but user have to press 'my location' button to move the map.
question, How do I zoom in automatically to the current location in Google Maps when loading a google map ?
i try, but lat and long always 0
B4X:
Sub Activity_Create(FirstTime As Boolean)
Wait For MapFragment1_Ready
gmap = MapFragment1.GetMap
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then
Log(Tracker.gpslat)
Log(Tracker.gpslong)
gmap.MyLocationEnabled = True
gmap.MyLocation.Initialize(Tracker.gpslat,Tracker.gpslong)
longlat = gmap.MyLocation
If gmap.MyLocation.IsInitialized Then
Dim CameraPosition1 As CameraPosition 'CameraPosition1.Initialize2(gmap.MyLocation.Latitude, gmap.MyLocation.Longitude, gmap.CameraPosition.Zoom, 0, 0)
CameraPosition1.Initialize(gmap.MyLocation.Latitude,gmap.MyLocation.Longitude, 17)
gmap.moveCamera(CameraPosition1)
End If
Else
Log("No permission!")
End If
End Sub
i also use https://www.b4x.com/android/forum/threads/background-location-tracking.99873/
thank you for your help