Android Question b4a 8.30 Starter service

coslad

Well-Known Member
Licensed User
Longtime User
hi
with b4a 8.30 the Starter service is never killed ,so , can we use it as watchdog service to restart a service if it is closed from OS?

Erel can you describe how you did to prevent Starter service to be killed ?

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
with b4a 8.30 the Starter service is never killed
Not exactly. The starter service will be killed when the os kills the process.

What has changed?

- Starting from Android 8 the OS can kill specific services without killing the process. This makes the program state more complicated as you can no longer assume that the starter service is running.
- B4A v8.3 changes the behavior of the starter service and it is kept running as long as the process is alive. Under the hood the starter service starts as a real service and later switches to the application context. When your app is in the background the OS will kill the native service however from your program perspective it will still be alive
If you are running a program on Android 8 and move it to the background then you will see this message in the logs after about a minute:

** Service (starter) Destroy (ignored)**
 
Upvote 0

coslad

Well-Known Member
Licensed User
Longtime User
This was what I wanted to hear.

If Android 8 no longer kills the processes but only services and the starter service is no longer killed , then with a timer into the starter you can check if another service has been killed and possibly restart it .

Great !
 
Upvote 0
Top