Re-Enabling the Alarm

mcasanket70

New member
Mar 21, 2014
4
0
0
Visit site
Hi All,

I have created one Alarm in my application. Later the user can disablethe alarm and also re-enable alarm.

The problem is that, when user clicks on re-enable the alarm, I create a new alarm with the previous time but the alarm gets fired instantly... :(

I am setting the alarm as below...
alarmManager.setRepeating(AlarmManager.RTC, time, AlarmManager.INTERVAL_DAY, PendingIntent.getBroadcast(this, alarmUniqueCode, intentAlarm, PendingIntent.FLAG_UPDATE_CURRENT));

How I disable the alarm when the user clicks on disable...

sender = PendingIntent.getBroadcast(this, 1, intent, 0);
alarmManager.cancel(sender);


I have added the Alarm receiver in manifest file like below.
<receiver
android:name="com.sign.android.myscheduler.app.AlarmReceiver"
android:enabled="true"
android:exported="true" >
</receiver>

Please help....
 

Forum statistics

Threads
943,143
Messages
6,917,503
Members
3,158,840
Latest member
wei34