planb-android icon indicating copy to clipboard operation
planb-android copied to clipboard

Have you considered scenarios for when a ForegroundService crashes?

Open sobvan opened this issue 7 years ago • 2 comments

It looks like for the restart you need an Activity in the foreground. I would like to make my ForegroundService restart if there is an exception. I will experiment with this anyway, but maybe someone has some suggestions.

sobvan avatar Aug 02 '18 16:08 sobvan

AFAIK you can inject your own behaviour through DI with the provided interfaces. I do not fully understand your use case, but if you have any improvement suggestions Im open/looking forward to a PR :)

patrickfav avatar Aug 03 '18 16:08 patrickfav

To make it more clear. My app uses a ForgroundService to be able to constantly run in the backgorund. It is called ForegroundService because there is an ongoing notification displayed all the time. So most of the time there is no Activity associated with my app. But it might still crash when running without an activity. And I still want it to restart. I will experiment with it and come back with a PR if there is a solution.

sobvan avatar Aug 07 '18 03:08 sobvan