5

I have a Foreground Service and on Samsung devices android OS kills my Foreground Service after a week or two .

I have a fitness app that runs Foreground Service 24 hours and it will not be destroyed. In OnCreate() and OnStartCommand() method of a service i am calling (startForeground()) and also onDestroy Method I am running a Broadcast Receiver to restart my Foreground Service but every time OnDestroy Method is not called when OS kills your Service

I have checked and test every solution given in stackOverflow but did not Work.

Any Solution ...?

saim malik
  • 51
  • 2
  • there is a feature in android 9+ known as "background usage limits" in battery settings of android phone. check if its OFF and check for weeks and see if problem solved or not. there also an intent to direct user to this settings for turning it off. – Saeed Arianmanesh Dec 01 '22 at 14:39

0 Answers0