Tuesday, March 20, 2012

[android-developers] AlarmManager.RTC don´t work

Hi,

I want to start a service for example every hour. I implement an
AlarmManager:

AlarmManager mgr
=(AlarmManager)Main.this.getSystemService(Context.ALARM_SERVICE);
Intent i = new Intent(this.getApplicationContext(),
UpdateWidgetService.class);
PendingIntent pi =
PendingIntent.getService(this.getApplicationContext(), 0, i,
Intent.FLAG_ACTIVITY_NEW_TASK);
mgr.cancel(pi);
mgr.setRepeating(AlarmManager.RTC, System.currentTimeMillis(),
Integer.parseInt(listUpdate.getValue())*3600000, pi);


So I cancel the manager which was startet before and then create a new
one.

I thought the parameter "RTC" ensures that the Alarm not beeing fired
when the device is in sleep mode (i turned the display off and the
device was 1 hour not turned on)... But nevertheless the service is
started...

So what am I doing wrong? Thanks

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment