In my app, I have Activity A ( home activity) --->> then Activity B --->> Then foreground service.
Application runs for an hour then in notification bar I get "This app is consuming power > 40mhA". Within another hour the app is killed.
Reference to this, it's possible to keep the service running even after killing the app , but this is not the target.
My question: is it possible to keep the app running and overcome system killing?
Thanks
As far as I know, if the OS has decided to kill your application due to power consumption - there is nothing you can do to keep it running.
The best thing you can do is check why it consumes that much battery and optimize it through your code. I know that sometimes it seems like there is nothing you can do to optimize it, but trust me, there is. Maybe you are using a service in a wrong way that abuses it?
If you will post your code here we can try help you fix it :)