my code
call service using CallSubDelayed2(GPSService, "StartGPS", jobId)
GPSService
Sub Process_Globals
' 'These variables can be accessed from all modules.
Private GPS1 As GPS
Dim GPS_On As Boolean : GPS_On = False
Private jID As String
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
If GPS_On = True Then
GPS1.Stop
End If
End Sub
Sub StartGPS(docID As String)
GPSDocID = docID
If GPS1.IsInitialized = False Then
GPS1.Initialize("GPS")
End If
If GPS1.GPSEnabled = False Then
ToastMessageShow("Please enable the GPS device.", True)
StartActivity(GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
firstNode = True
parser.Initialize
GPS1.Start(0, 0)
End If
End Sub
Sub GPS_LocationChanged (Location1 As Location)
If GPS_On = False Then
Main.gpsLat = NumberFormat(Location1.Latitude, 1, 6)
Main.gpsLong = NumberFormat(Location1.Longitude, 1, 6)
saveLocation
End If
End Sub
Sub GPS_UserEnabled (Enabled As Boolean)
ToastMessageShow("GPS device enabled = " & Enabled, True)
End Sub
Sub GPS_GpsStatus (Satellites As List)
End Sub
Sub saveLocation()
GPS_On = True
GPS1.Stop
End Sub