Good afternoon,
I need a little help here with GPS or Location Manager.
I'm trying to integrate either one of them in a service module - but I only get zero values.
Here's a piece of the code I'm using:
Is this not working because it's running in a service module?... But neither the simple GPS is...
Help nedeed... Thanks,
Kepler
I need a little help here with GPS or Location Manager.
I'm trying to integrate either one of them in a service module - but I only get zero values.
Here's a piece of the code I'm using:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Timer_Location As Timer
Dim VLongitude As Double = 0
Dim VLatitude As Double = 0
Dim Velocity As Double
Dim lm As LocationManager
End Sub
Sub Service_Create
lm.Initialize("Location")
Timer_Location.Initialize("TimerLocation",30000) '60 s = 60000 ms
Timer_Location.Enabled=True
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)
VLongitude = Longitude
VLatitude = Latitude
ToastMessageShow(VLongitude & " / " & VLatitude,False)
End Sub
Sub Location_ProviderDisabled (Provider As String)
'Msgbox("Provider","Provider Disabled")
End Sub
Sub Location_ProviderEnabled (Provider As String)
'Msgbox("Provider","Provider Enabled")
End Sub
Sub Location_StatusChanged (Provider As String, Status As Int)
'Msgbox("Provider: " & Provider & CRLF & "Status: " & Status,"Status Changed")
End Sub
Sub TimerLocation_Tick
'Handle tick events
lm.requestGPSLocation
Log("Request sent...")
End Sub
Is this not working because it's running in a service module?... But neither the simple GPS is...
Help nedeed... Thanks,
Kepler