Can someone tell me why the service is not finished?
In the sub "Activity_Pause" it should be terminated but will not (see screenshot).
B4X:
Sub Activity_Pause (UserClosed As Boolean)
If UserClosed Then
' Log("UserClosed=" & UserClosed)
mBBL.goWriteIniFile
PhoneAwake.ReleaseKeepAlive
'Bluetooth verbindung aufheben
Starter.bluetooth.DestroyConnection
If Starter.GPS1.GPSEnabled Then
Starter.GPS1.stop
Starter.GPS_On = False
End If
'Service beenden
StopService(Starter)
StopService(smAtomtime)
ExitApplication
Else
Starter.IsStartEnabled = tbtnStart.Enabled
End If
End Sub
As I'm sure you know, you shouldn't call ExitApplication. This kills the process instead of letting the OS handle the process life cycle. In this case it probably kills it before the service was stopped so Android recreates it.
You are trying to solve a non-existent problem. By doing so you are adding real problems to your app.
1. It is a mistake to call ExitApplication (in almost all cases).
2. You don't need to worry about services kept alive by the OS. This is the responsibility of the OS to kill the process when the app is in the background.
Hi Filippo
There must be something odd in you code. I have seen that if I start twice the GPS in same process and terminate it only once the GPS continues to work.
Check your code...
Hi Filippo
There must be something odd in you code. I have seen that if I start twice the GPS in same process and terminate it only once the GPS continues to work.
Check your code...