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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -