How To Cancel Pendingintent At Specific Time?
AlarmManager works perfectly when I have not declared cancel but do not fire when I declare the cancel.. Here is the code: Calendar c= Calendar.getInstance(); c.set
Solution 1:
Change the line am1.cancel(pi);
to am1.cancel(pi1);
- you're cancelling the original PendingIntent
Also, in your cancel code, you're calling c.add()
(which add on to the current date/time) instead of c.set()
(which explicitly sets the next date/time). By calling c.add(Calendar.MINUTE, 38)
, you're actually adding 38 minutes to the current Calendar, instead of setting the time to 12:38;
Post a Comment for "How To Cancel Pendingintent At Specific Time?"