java - How to set calendar for notification before 10 minutes of the event? -
i have created events. want set notification before 10 minutes of start time of event.
i have seen in google calendar have set this.
how can set calendar time before events?
here getting calendar instance , setting calendar.
public void notification(calendar c) { calendar cal = calendar.getinstance(); int year = cal.get(calendar.year); int month = cal.get(calendar.month); int day = cal.get(calendar.date); int hour = cal.get(calendar.hour_of_day); int minute = cal.get(calendar.minute); cal.set(calendar.hour_of_day, hour); cal.set(calendar.minute, minute); cal.set(calendar.second, 0); cal.set(calendar.millisecond, 0); cal.set(calendar.date, day); notification = c.gettime(); notificationtime = df.format(notification); // notifytime.settext(notificationtime); toast.maketext(getapplicationcontext(), string.valueof(notification), toast.length_short).show(); intent intent = new intent(getbasecontext(),notificationreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(getbasecontext(), rqs_1, intent, 0); alarmmanager alarmmanager = (alarmmanager)getsystemservice(context.alarm_service); alarmmanager.setinexactrepeating(alarmmanager.rtc_wakeup, c.gettimeinmillis(), alarmmanager.interval_day *7, pendingintent); componentname receiver = new componentname(getapplicationcontext(),notificationreceiver.class); packagemanager pm = getapplicationcontext().getpackagemanager(); pm.setcomponentenabledsetting(receiver, packagemanager.component_enabled_state_enabled, packagemanager.dont_kill_app); }
thank you..
Comments
Post a Comment