Search code examples
androidbroadcastreceiveralarmmanagerandroid-broadcastreceiverbootcompleted

AlarmManager with BOOT COMPLETE broadcast receiver stop working after few days


I've created app using AlarmManager to schedule the actions.

When the device is restart or boot again. It will intercepted by BOOT COMPLETE broadcast receiver to re-schedule all the actions. Currently it works fine as expected.

However, after few days running fine. User don't interact or manually open the app. Android OS seem to change the state of the application to "Stopped State".

Which means if there are any reason the device is boot or restart, The Broadcast Receiver BOOT COMPLETE can't receive anymore. Android OS will ignore all broadcast receiver for this app.

Then, it turns out the application can't reschedule the actions. SO, app is stop working.

So my question is, is there any work around for this problem ?


Solution

  • This is more related to manufacturer app customise on Android API. We can overcome by checking app running and keep it aways from Stop State.