Nothing leaps out at me as being wrong, other than
getApplicationContext() (just use this instead of c). But that should
not cause a problem. Make sure that this section of code is being
executed, and make sure there are no warnings of note in LogCat.

On Thu, Jan 26, 2012 at 3:50 AM, Rudolf Polzer <rudolf.pol...@i-r-p.de> wrote:
> Please give me a hint why the AlarmManager does not fire.
> In my app, the AlarmManager is set after a user action:
>
>   Context c = this.getApplicationContext();
>   AlarmManager am =
> (AlarmManager)c.getSystemService(Context.ALARM_SERVICE);
>   Intent i = new Intent(c, OnAlarmReceiver.class);
>   PendingIntent pi = PendingIntent.getBroadcast(c, 0, i, 0);
>   am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 10000,
> pi);
>
> The "+ 10000" is for testing - this numer will be replaced by a bigger
> one.
> The manifest file contains
>
>    <receiver android:name=".OnAlarmReceiver"></receiver>
>
> And the alarm receiver code is never executed:
>
>  public class OnAlarmReceiver extends BroadcastReceiver {
>  @Override
>  public void onReceive(Context context, Intent intent) {
>  // ...code here is never executed
>  }
>  }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android Training in DC: http://marakana.com/training/android/

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to