Hi ....
I'm using GPS (1.2) and LocationManager (1.10) libraries , for getting my location , but sometimes return 0 instead of the current location.
is there anything wrong in my code ?
Thank you
I'm using GPS (1.2) and LocationManager (1.10) libraries , for getting my location , but sometimes return 0 instead of the current location.
is there anything wrong in my code ?
B4X:
' GPS
Sub GetLocation
Location.Initialize("Location")
GPS1.Initialize("GPS")
If GPS1.GPSEnabled = False Then
StartActivity(GPS1.LocationSettingsIntent)
Else
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
End If
End Sub
Sub Activity_PermissionResult (Permission As String, Result As Boolean)
If Permission = rp.PERMISSION_ACCESS_FINE_LOCATION Then
If Result Then
GPS1.Start(0, 0)
Location.requestMobileLocation
Else
GPS1.Stop
End If
End If
End Sub
Sub Location_LocationChanged (Longitude As Double, Latitude As Double, Altitude As Double, Accuracy As Float, Bearing As Float, Provider As String, Speed As Float, Time As Long)
verb_Latitude = Latitude
verb_Longitude = Longitude
Location.stopMobileListening
GPS1.Stop
End Sub
Thank you