Hi guys.
I have to get lat and lon values for my project but i only use it one time on opening.
LocationChange event trigger when device is moving. I want to get location without moving and without locationchange event, how can i do it ? Get current location.
Now im using, this kind of codes.
I have to get lat and lon values for my project but i only use it one time on opening.
LocationChange event trigger when device is moving. I want to get location without moving and without locationchange event, how can i do it ? Get current location.
Now im using, this kind of codes.
B4X:
Sub Activity_Resume
If GPS1.GPSEnabled = False Then
ToastMessageShow("You have to open location service.", True)
StartActivity(GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
If Result Then CallSubDelayed(Me,"StartGPS")
End If
End Sub
Public Sub StartGps
GPS1.Start(0, 0)
ProgressDialogShow("Getting GPS Values")
End Sub
Sub GPS_LocationChanged (Location1 As Location)
Log("LATI:" & Location1.Latitude)
Log("LONG:" & Location1.Longitude)
StopGps
End Sub
Last edited: