Android Question Loss variable within service

AHilberink

Active Member
Licensed User
Longtime User

Hi,

I have a question about this.
Using B4A v8.80 with an Andriod 8 device, I have problems keeping my variables filled.

Like the MyLocation example, I use:
B4X:
Sub Service_Create
    Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER 'we are handling it ourselves

Every time Service_Destroyed is fired. I read about "Service.StartForeground" preventing this from happening, but I don't need a Notification. After Destroyed, values of my variables are empty, even the one I put in Global of the Starter Service.

Do I need to save them and reload the every Service_Create or are there other possibilities?

Best regards,
André
 

AHilberink

Active Member
Licensed User
Longtime User

Thanks.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…