When android removes my activity from the memory (due to people switching to other apps probably) I want to restart the app completely when they come back to the app. Is this possible with the starter service or is there another solution?
- start the service in foreground (a notification will be set to inform the user that there's an app running in the "background). This is very reliable. The Service will be restarted.
B4X:
Sub Service_Create
sNotif.Initialize
sNotif.Icon = "icon"
sNotif.Vibrate=False
sNotif.SetInfo2("GPSPinger","Service Running","FromNotification",Main) 'If the notification is clicked, the main activity will be started
sNotif.Sound = False
sNotif.Notify(1)
Service.StartForeground(1,sNotif)
EndSub
Even better:
- if your app can be triggered (e.g. new SMS or Firebase Message, etc.) use an intent. The app (the service) will be started automatically. Search for "intercept" and/or "intents"
When android removes my activity from the memory (due to people switching to other apps probably) I want to restart the app completely when they come back to the app.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.