Shoaib Ahmed
Shoaib Ahmed

Reputation: 781

Multiple Notifications from Foreground service Android

I'm working on an application where I need to show notifications 5 times a day ...from a foreground service..the purpose of using the foreground services is to be able to display notification even if the application is closed . so I want to start the service as applications starts and schedule its notification timing accordingly I have tried using the snippet provided on android developers forum but its not working for me ... any help and sample code is highly appreciated Thanks

Upvotes: 1

Views: 1560

Answers (1)

Akhil
Akhil

Reputation: 14038

If the notifications are to be fired at a fixed time, you may not need a foreground service. It is a bad idea to keep a service running just to show notifications. Schedule those five times using an AlarmManager.

You can find tutorial for it in google. You would need to schedule alarms one by one. Foe ex..when alarm manager wakes your app the first time , then schedule a second alarm and son on.. You may not be able to set 5 concurrent alarm schedules. Do it one by one..

Upvotes: 2

Related Questions