Android Question starter service variables, other services

Stern0m1

Member
Licensed User
Do services get killed by the os or does processes get killed by the os?

Does the os sometimes clear the memory being used by one service of an app and let another live?


Im slightly confused with all the terminology...

Im trying to understand if variables declared in the starter service will stay around for other services to access or there is a chance that the memory being used for those variables will be cleared when the starter service gets killed.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Do services get killed by the os or does processes get killed by the os?

Does the os sometimes clear the memory being used by one service of an app and let another live?
The OS will never kill a service without killing the whole process. Services can be destroyed by calling StopService.

Im trying to understand if variables declared in the starter service will stay around for other services to access or there is a chance that the memory being used for those variables will be cleared when the starter service gets killed.
The variables will be kept alive.

As a general rule all public global objects should be declared in the Starter service and initialized in Service_Create.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…