Note that there are some explanatory texts on larger screens.

plurals
  1. POAlarmManager not waking phone up in Air Mode (onReceive delayed)
    primarykey
    data
    text
    <p>Problem is that <code>onReceive</code> method of <code>BroadcastReceiver</code> usually "called" by <code>AlarmManager</code> is delayed until device is awoken by the user.</p> <p>This has never happened to me, only information I have was is from the report sent by user. In the log I saw that in the first case <code>onReceive</code> method call was delayed by almost 2 hours and in the second one by about 20 minutes. In both situations alarm (and <code>onReceive</code>) has started just after the phone was awoken by the user. </p> <p>Problem has occured twice in two consecutive days and user states it has never happened before. Only distinctive change in phone's settings was that Air Mode was enabled.</p> <p>My code:</p> <p>Alarm is set like:</p> <pre><code>PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, alarmIntent, PendingIntent.FLAG_UPDATE_CURRENT); am.set(AlarmManager.RTC_WAKEUP, timeInMillis, pendingIntent); Logger.log("posting alarm " + id + " for " + formatTime(timeInMillis); </code></pre> <p>Broadcast Receiver's onReceiveMethod:</p> <pre><code>@Override public void onReceive(Context context, Intent intent) { Logger.initialize(context, "AlarmReceiver"); ... } </code></pre> <p>Logs received from the user:</p> <pre><code>481. 20/05 13:00:04 v89: posting alarm 4 for 7:0 (in 17:59) 486. 21/05 08:58:00 v89: logger initialized again from AlarmReceiver 536. 21/05 09:04:54 v89: posting alarm 4 for 7:0 (in 21:55) 541. 22/05 07:22:24 v89: logger initialized again from AlarmReceiver </code></pre> <p>Is it possible for Air Mode to block phone's awakening somehow? Can I prevent it? Or maybe it is something completely different? Any help is welcomed.</p> <p>Device is Samsung Galaxy SIII (GT-I9305) with Android 4.1.2</p> <p>Edit: Just in case that delay could be somehow caused by the Logger, here's its code. <code>mHandler</code> is created with use of <code>HandlerThread</code>, so I believe it can't block <code>onReceive</code>, right?</p> <pre><code>public synchronized static void initialize(Context context, String src) { if (mInstance == null) {//wasn't null ... } else { Logger.log("logger initialized again from " + src); } } public synchronized static void log(final String text) { Log.d(TAG, text); if (mInstance != null &amp;&amp; mInstance.mLoggingEnabled) { mInstance.mHandler.post(new Runnable() { @Override public void run() { //some database operations } }); } } </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    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