Note that there are some explanatory texts on larger screens.

plurals
  1. POMy android alarms are being cancelled, and not by me
    primarykey
    data
    text
    <p>My app uses an alarm timer to check for updates on a server every 2 minutes or so. I create a recurring timer using this:</p> <pre><code> alarmIntent = new Intent(context, OnWakeUpReceiver.class); PendingIntent pIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, 0); mAlarmManager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), 120000, pIntent); </code></pre> <p>For the vast majority of people, this works just fine. But a small number of people report that the app suddenly stops updating itself. I put in a simple check that sees if the timer exists:</p> <pre><code> PendingIntent pIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_NO_CREATE); </code></pre> <p>and sure enough, when the app is no longer updating, this return null, indicating no timer still exists.</p> <p>My app had been controlling the alarm timer (turning it off when there was no network connection, then turning it back on when there was, and other scenarios). I thought perhaps I was somehow turning it off and not turning it back on. So I created a version where I removed every call to cancel the alarm timer. So my app no longer has any means to cancel that timer. But after just a few days time, once again the alarm timer is no longer present, and the app is not updating.</p> <p>I haven't been able to get this to happen on my own systems, or have someone find a foolproof way to repeat it on theirs. I wondered if maybe the Android system was cancelling it (though that would stop my app from ever working again), but on one of the more problem systems, he said he hardly has anything running on the phone.</p> <p>I didn't know if task killers might kill alarm timers as well, but I understood that after I think SDK 8, task killers couldn't do that anymore anyway, and I've been having problems with post version 8. And also on systems that do not run task killers, and have not been rooted.</p> <p>I even created a "watchdog" alarm timer that ran a receiver just to check and see if the main app timer had stopped updating. What I found is that THAT timer was being cancelled as well (it gave no further "last ran" updates, and never noticed the main app had stopped).</p> <p>This problem is an app killer for me. Can anyone suggest any way even to try and debug when and what is happening? Is there any log entry made ever by the system when a timer gets cancelled, whether by the system or something else? I hate that it just evaporates away without a trace.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload