I stored the text_of_last_alarm in a file and checked with the
debugger that the cancel command really has got the text of the alarm
to cancel.
I understand that I should not use the intent type to carry arbitrary
test.

I also tried to transport the text with the intent extras as you
suggested, but the OnAlarmReceiver gets an intent with just
"android.intent.extra.ALARM_COUNT" as the only extra - the text I gave
to the intent is lost. So I was looking for another way to feed some
text through the AlarmManager.

Most important to me: the cancelling of an alarm still does not work,
even when I set neither type nor extras of the intent.
Cancelling of the old alarm and setting a new one now looks like this:

  AlarmManager am = (AlarmManager)
   context.getSystemService(Context.ALARM_SERVICE);
  Intent x = new Intent(context, OnAlarmReceiver.class);
  PendingIntent pi = PendingIntent.getBroadcast(context, 0, x, 0);
  am.cancel(pi);
  if(alarm_needed) am.set(AlarmManager.RTC_WAKEUP, time, pi);

These lines are called with every alarm change.

-- 
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