I have an android app that has registered a BroadcastReceiver
to get BOOT_COMPLETED
(I have the required permissions and everything configured in the manifest).
When it gets it, it schedules a runnable to run every X minutes:
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
executor.scheduleAtFixedRate(new Runnable() {
public void run() {
}
}, 0, 2, TimeUnit.MINUTES);
The same method is invoked also manually when the user launches the app.
- when the app is manually launched, the scheduled runnable runs as expected
- when the app has received
BOOT_COMPLETED
the scheduled runnable runs only once (successfully), then stops and never runs again. There are no exceptions, but it doesn't run.
Why might that be happening?