2

I am setting the FLAG_INSISTENT to my notification to repeat the sound of the notification. My problem is that I do not know how to stop the sound after five minutes to save batteries.

I already tried to cancel the notification, but there the user will not see the notification after that.

This is how I add the FLAG_INSISTENT:

Notification note = mBuilder.builder();
note.flags = Notification.FLAG_INSISTENT;
mNotifM.notify(AppConfig.NOTIFICATION_ID, note);

I already had the idea to cancel the notification after five minutes and creating a new one with no vibration and sound. Is there any other possibility to stop the sound after five minutes?

Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98
naggab
  • 371
  • 4
  • 18
  • Have you tried republishing the same notification id but without that flag? Sending a new notification with the same id is supposed to update the old one. – Gabe Sechan Aug 06 '19 at 15:45
  • 1
    `I already had the idea to cancel the notification after five minutes and creating a new one with no vibration and sound. Is there any other possibility to stop the sound after five minutes?` - This is the idea that I had in my mind too. I think you can go for it. – Reaz Murshed Aug 06 '19 at 15:49

0 Answers0