Hello!
My app requires a GPS Recorder service which continuously writes GPS data to internal storage throughout the life of the process.
The following code works well when the Main activity is active. However, even though the GpsRecorder service is not destroyed, recording stops when the Main activity is paused, and resumes when the activity resumes.
Sub Activity_Create(FirstTime As Boolean)
StartService(GpsRecorder)
End Sub
Sub Process_Globals
Private GpsLock As PhoneWakeState
Dim MyGps As GPS
Dim GpsData As GpsDataStruct
End Sub
Sub Service_Start (StartingIntent As Intent)
GpsLock.PartialLock
MyGps.Start(0, 0)
ToastMessageShow("GPS recorder started", False)
End Sub
Sub Service_Destroy
ToastMessageShow("GPS recorder stopped", False)
End Sub
Sub MyGps_LocationChanged(Loc As Location)
GpsData.GpsUtc = Loc.Time
GpsData.Lat = Loc.Latitude
GpsData.Lon = Loc.Longitude
WriteGpsBin
End Sub
Sub WriteGpsBin
' Writes GPS data to internal storage
End Sub
What seems particularly unusual is that when another app that records GPS data (Oruxmaps,
www.oruxmaps.com) is running on the same device at the same time, then my GPS recorder does not pause, and performs just as it should.
There is a good deal of information about using GPS on the Forum but I have not been able to find posts which address this specific issue. Any advice would be gratefully appreciated.