1

I am creating a notification at particular time using alarm Manager and notification manager, i gave user three action in notification bar "Snooze", "Cancel", "Take". Here is the situation i want to resend the notification after 10 min of this notification again and again till the user presses these above buttons. Can any body help and provide a decent logic to do this.

Mukesh Gupta
  • 1,373
  • 3
  • 17
  • 42

1 Answers1

1

I would schedule a repeating Alarm and only cancel it on a non "Snooze" action. See the setRepeating method of AlarmManager

https://developer.android.com/reference/android/app/AlarmManager.html#setRepeating(int,%20long,%20long,%20android.app.PendingIntent)

to schedule a new alarm after the initial one goes off, you'll want to start a service with the AlarmManager which can then handle the Snooze action for you.

Using Alarmmanager to start a service at specific time

Community
  • 1
  • 1
Dave S
  • 3,378
  • 1
  • 20
  • 34
  • 1
    Yes i can setRepeat but the problem i am facing is that i am already using setRepeat for repeating for regular days. – Mukesh Gupta Oct 24 '16 at 20:32
  • I was thinking when user presses any button i will again set new alarm for after some time(say user presses snooze after 10 min ) so i will using alarmmanager.set function for this – Mukesh Gupta Oct 24 '16 at 20:33