alarmmanager - Set monthly repeating notification in Android -
i set notification @ 8th of every month.
this did:
intent myintent = new intent(remember.this, receiver.class); pendingintent pendingintent = pendingintent.getbroadcast(remember.this, 0, myintent, 0); alarmmanager alarmmanager = (alarmmanager)getsystemservice(alarm_service); // set alarm start @ approximately 8th of calendar calendar = calendar.getinstance(); calendar.settimeinmillis(system.currenttimemillis()); calendar.set(calendar.day_of_month, 8); alarmmanager.setinexactrepeating(alarmmanager.rtc_wakeup, calendar.gettimeinmillis(), alarmmanager.interval_day*30, pendingintent);
however got constant notification within minutes. , not go away.
would appreciate here not know went wrong.
set calendar upcoming 8th of month.
alarmmanager.set(alarmmanager.rtc_wakeup, calendar.gettimeinmillis() , pendingintent);
inside receiver.class
public void onreceive(context context, intent intent) { //do action needed //invoke alarmmanager in mainactivity // cancel previous alarm // set new alarm next month }
Comments
Post a Comment