You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How to reconnect to foreground service after app is closed #365
Perhaps I should rephrase the question:
Can you provide an example or work flow on how to reconnect to the foreground service once the main app is killed and then restarted.
For instance, the user kills running apps, the foreground service is still running. Then when the app is restarted, I would like to connect to the same running foreground service.
No, I am need to know how to re-connect to the foreground service once the has been killed, then restarted. I need to reconnect to the same FGS not a new one. Nothing to do with restarting/booting the device.
There are two options with the FSG.
to kill the service when the app is closed completely, (killed) or:
leave the service running to complete tasks.
I would like to keep the service running even if the user kills the app, I am having trouble with reconnecting to the same running service in the above situation.
Activity
monfadev commentedon Nov 3, 2025
basically android already prevent running foreground services from background.
https://developer.android.com/develop/background-work/services/fgs/restrictions-bg-start
AlastairOZ commentedon Dec 7, 2025
Perhaps I should rephrase the question:
Can you provide an example or work flow on how to reconnect to the foreground service once the main app is killed and then restarted.
For instance, the user kills running apps, the foreground service is still running. Then when the app is restarted, I would like to connect to the same running foreground service.
monfadev commentedon Dec 10, 2025
when the device restarted, you wanna run FGS again right? lets explore about boot
AlastairOZ commentedon Dec 15, 2025
No, I am need to know how to re-connect to the foreground service once the has been killed, then restarted. I need to reconnect to the same FGS not a new one. Nothing to do with restarting/booting the device.
There are two options with the FSG.
I would like to keep the service running even if the user kills the app, I am having trouble with reconnecting to the same running service in the above situation.