AlarmManager not working when phone is locked
<p><code>AlarmManager</code> does not start my broadcast receiver when phone is locked for example. I search and try many solutions but none works:</p>

<pre><code> AlarmManager mgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
      Intent i = new Intent(context, OnAlarmReceiver.class);
      PendingIntent pi=PendingIntent.getBroadcast(context, 0, i, 0);

      mgr.setRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP,
                        SystemClock.elapsedRealtime()+60000,
                        PERIOD,
                        pi);
</code></pre>

<p>but <code>OnAlarmReceiver</code> is never fired!</p>

<p>I also try with <code>WakeLock</code>:</p>

<pre><code>@Override
    public void onReceive(Context context, Intent intent) {
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
        PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "");
        wl.acquire();
// code
wl.release();
 }
</code></pre>

<p>but also not working. why?</p>
