Android Question GPS Recorder Service: Unusual Behaviour


New Member
Licensed User

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)
End Sub
GpsRecorder Service:
Sub Process_Globals
    Private GpsLock As PhoneWakeState
    Dim MyGps As GPS
    Dim GpsData As GpsDataStruct
End Sub

Sub Service_Start (StartingIntent As Intent)
    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
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, 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.


Licensed User


New Member
Licensed User
Thank you Manfred, I will look through the example and implement the required changes.

But how do you explain the interaction between the two concurrently running apps regarding pausing of the GPS recorder service?