Android Question starter service life cycle

a n g l o

Active Member
Licensed User
Longtime User
hi, the last 2 lines of this post from 2018 are :
Update: Starting from B4A v8.3 the starter service will never be killed unless the whole process is killed. This means that you can always assume in your code that the starter service is running.
It is done internally by changing the starter service context to the application context.
i'd like to know if it still valid.
if yes - is there a way to make other service(s) to behave the same ?
if not - what's the best way (not including b4xPages) to keep an app alive even when activities are all in the back for hours and all services not used for hours ?

thank you
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Best solution is of course to switch to B4XPages.

The starter service will never be killed, as long as the process running.

It isn't possible to make other services behave the same, unless you prevent them from being killed by making them foreground services.
With or without B4XPages, if you want your app to run in the background, you need a foreground service.

Note that the starter service shouldn't be set as a foreground service.
 
Upvote 0

a n g l o

Active Member
Licensed User
Longtime User
Best solution is of course to switch to B4XPages.

The starter service will never be killed, as long as the process running.

It isn't possible to make other services behave the same, unless you prevent them from being killed by making them foreground services.
With or without B4XPages, if you want your app to run in the background, you need a foreground service.

Note that the starter service shouldn't be set as a foreground service.
Erel thank you very much.
one follow up : you say "as long as the process running". will it stand a screen shutdown ?
thanks.
 
Upvote 0
Top