开发者

Android Notification repeatation

I want to se开发者_JAVA技巧t 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.


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......


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜