dev_android
dev_android

Reputation: 8818

Android Notification repeatation

I want to set notification for an event which will repeat every day. So the notification should come everyday at event time. How to set any notification in NotificationManager so that it repeats after certain period of time.

Upvotes: 0

Views: 1277

Answers (3)

Prasham
Prasham

Reputation: 6686

If you are using AlarmManager class, it's more easier that to setup a service.

alarmManager class has a setRepeating method that repeats your alarm call at given interval after given time.

Like..

AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);

Intent AlarmIntent = new Intent(CONTEXT, RECEIVERCLASS.class);
        ID,AlarmIntent, PendingIntent.FLAG_UPDATE_CURRENT);

    alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,YOURCALENDAR.getTimeInMillis(), AlarmManager.INTERVAL_DAY, Sender);

In the setRepeating argument, you can set the YOURCALENDAR member to the time you want......

Upvotes: 2

milind
milind

Reputation: 970

for this u have 2 made one service class that notify your event. when any event occurs just call start notification on event. if u not get proper idea that comment on this ans. i'll explain in detail.

Upvotes: 0

ernazm
ernazm

Reputation: 9268

You kinda need a Service for this, if I got your question right

Upvotes: 1

Related Questions