AlarmManager.RTC not working?
<p>I changed AlarmController.java in ApiDemo a little bit, so I want the alarm not to go off when the phone is sleeping by using AlarmManager.RTC.</p>

<pre><code>        Intent intent = new Intent(AlarmController.this, RepeatingAlarm.class);
        PendingIntent sender = PendingIntent.getBroadcast(AlarmController.this,
                0, intent, 0);

        // We want the alarm to go off 30 seconds from now.
        long firstTime = SystemClock.elapsedRealtime();
        firstTime += 15*1000;

        // Schedule the alarm!
        AlarmManager am = (AlarmManager)getSystemService(ALARM_SERVICE);
        am.setRepeating(AlarmManager.RTC, //AlarmManager.ELAPSED_REALTIME_WAKEUP,
                        firstTime, 15*1000, sender);
</code></pre>

<p>The receiver code is like below:</p>

<pre><code>public class RepeatingAlarm extends BroadcastReceiver
{
    @Override
    public void onReceive(Context context, Intent intent)
    {
        Log.d("DEBUG", "In RepeatingAlarm.onReceive, intent=" + intent);
        Toast.makeText(context, R.string.repeating_received, Toast.LENGTH_SHORT).show();
    }
}
</code></pre>

<p>I ran the modified app, but I still see many log messages as below after the phone wento sleep (the screen was black):</p>

<p>D/DEBUG   ( 1390): In RepeatingAlarm.onReceive, intent=Intent { flg=0x4 cmp=com.example.android.apis/.app.RepeatingAlarm (has extras) }</p>

<p>This means the flag AlarmManager.RTC didn't work. Can someone tell me why?</p>

<p>Thanks.</p>
