benbahrenburg / benCoding.AlarmManager

Titanium Module for working with the Android AlarmManager
Other
98 stars 85 forks source link

How to cancel a notification! #70

Open fernandojorgerodriguessilva opened 8 years ago

fernandojorgerodriguessilva commented 8 years ago

Hi guys, I'm currently developing a project where I need to receive notifications during a date range . How can i cancel a notification that is on repeat mode?

EDIT: Even if I create multiple notifications , they do not shoot correctly... Example code: var now = new Date(); for(var i=1; i<10; i++){ now.setMinutes(now.getMinutes()+1); alarmManager.addAlarmNotification({ requestCode:i, year: now.getFullYear(), month: now.getMonth(), day: now.getDate(), hour: now.getHours(), minute: now.getMinutes(), second:now.getSeconds(), contentTitle:'Alarm teste '+i, contentText:'Alarm & Notify Scheduled', //sound: Ti.Filesystem.getResRawDirectory() + 'alarm', //Set a custom sound to play, located at: platform/android/res/raw/alarm.mp3 //repeat:60000 //You can use the words hourly,daily,weekly,monthly,yearly or you can provide milliseconds. }); } It is supposed to trigger a notification per minute but fired , for example, notification 1 in minute 1 (correct), notifications 2 and 3 in minute 3 (should send notification 2 in minute 2 and notification 3 in minute 3) , notifications 4, 5, 6 in minute 6 ... Any help?

Thanks and keep the good work :