scheduled tasks - scheduling and editing an event to occur at a specific time android -
i building app needs perform action @ specific date , time , put notification hour before task performed.
i have searched , found alarm manager class can used purpose not sure how use it. if in future point cancel or edit once application closed , reopened.
i have created sqlite database stores information along date , time of event happen.
thanks
google provides "scheduler" code sample want: display notification @ given time. sample shows how cancel alarm.
edit : i've watched @ sample code again , right, sample doesn't explain how pendingintent after app closed , reopened. following code creates pendingintent if doesn't exist, , if exists, returns existing pendingintent, flag_update_current. don't have care if alarm has been started or not: pending intent, , cancel it.
intent intent = new intent(context, myalarmreceiver.class); pendingalarmintent = pendingintent.getbroadcast(context, 0, intent, pendingintent.flag_update_current); .... pendingalarmintent.cancel();
Comments
Post a Comment