0

I'am trying to find a way to use an NotificationCompat.Builder.addAction(...) to call some code to stop a repeating alarm without starting an activity... but as i understood so far the only thing I can do with this is start intents with Activities. There's any way I can stop the alarm without leaving the notification?

xpete
  • 417
  • 3
  • 14
  • I think you are trying to perform an action in the wrong place. Notification, as its name implies, is not a place to perform your business logic. That is why it gives you the option to invoke an activity. – Nazar Merza Feb 04 '13 at 17:45

1 Answers1

0

You can add request to alarm manager by calling set() function with PendingIntent as parameter. You just need to call cancel() with same PendingIntent, in order to stop it; though I note very clear about your notification question.

Munish Katoch
  • 517
  • 3
  • 6
  • Thx but I know how to cancel an alarm. My problem is to call the code from an notification button without leaving the notification. – xpete Feb 03 '13 at 04:06