Android Kills Process?

Hello,
I have an Android app that flashes Wi-Fi addressable lightbulbs when I receive a phone call.
It's based on the Taifun Notification Listener extension.

It works great for about the first hour or two, but after six hours or so it stops working. Sometimes I'll just have the phone start up to its lock screen, log in, or open the app and restart service and it will start working again.

I am running on a phone running Android 11. I know Android has become more aggressive in killing running processes – even services. I have a feeling that after a while Android kills the background service or the phone goes into a deep sleep mode that causes notifications not to be recognized.

Can anyone describe what is actually happening? Is there way to work around it? – Maybe setting something in Settings or setting a flag in the app?

Thanks for your help.
Barry.

This discussion talks about something similar

My app silently closes (after 18 hours running continuously plugged-in)

Also, try disabling the battery optimizations and removing the background restrictions of the app if possible.

There is a setting for "Never Sleeping Apps" in Settings-Battery-Advanced. I added my app to that. Hopefully it will make a difference.

Thanks.

2 Likes