Hi There
I have an application that displays multiple activities and needs to use the GPS as long as the app is running.
I added GPS as a service. The service is started using Main Activity create as follows
After the activity completes initialization, it starts another activity and so on
The GPS service is being used to update some globally shared data structure to provide GPS data through out the app.
I want to properly terminate the service when the user closes the application so that the battery is not wasted.
I added the following code in the main activity that started the GPS service
I never see the Log message.
What is the best way of terminating the service on app closed?
Thanks in advance
I have an application that displays multiple activities and needs to use the GPS as long as the app is running.
I added GPS as a service. The service is started using Main Activity create as follows
B4X:
StartService(GPSService)
After the activity completes initialization, it starts another activity and so on
The GPS service is being used to update some globally shared data structure to provide GPS data through out the app.
I want to properly terminate the service when the user closes the application so that the battery is not wasted.
I added the following code in the main activity that started the GPS service
B4X:
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed = True Then
StopService(GPSService)
Log("App closed, GPS stopped ")
End If
End Sub
I never see the Log message.
What is the best way of terminating the service on app closed?
Thanks in advance