Android Intent.ACTION_TIME_TICK doent gets when another app is in background

I have registered a broadcast receiver every minute from the main application of my app using Intent.ACTION_TIME_TICK. Its work fine when I log out of the application using the reverse key or home key.

But after exiting my application and launching any other random application ... the broadcast receiver will stop receiving minute ticks.

Plz help me on this not finding any solution for hours. I want to keep getting the one minute broadcast even when other apps are in the foreground.



source to share

1 answer

When your application is in the background, Android can terminate it at any time it wants. This usually happens when there is a need for memory, that is, when other programs are launched.

To prevent Android from automatically terminating your application, you need service . Using services makes it much less likely (but not impossible) for Android to kill your process when it needs memory.



All Articles