Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Identify and cancel an alarm send to an AlarmManager

If I use the AlarmManager to schedule an alarm (a PendintIntent which should be send), how can I identify that alarm later to cancel it? Can I cancel all alarms scheduled by my app?

like image 419
cody Avatar asked Nov 18 '10 08:11

cody


People also ask

How do I cancel AlarmManager?

In order to delete : AlarmManager alarmManager = (AlarmManager) getSystemService(Context. ALARM_SERVICE); Intent myIntent = new Intent(getApplicationContext(), SessionReceiver.

How does an application get access to the AlarmManager?

How does an application get access to the AlarmManager? Use the AlarmManager() constructor to create an instance of the AlarmManager. Use the AlarmManager. newInstance() method to retrieve the singleton instance of the AlarmManager.

How does alarm Manager work?

The Alarm Manager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing. This guarantees that the phone will not sleep until you have finished handling the broadcast. Once onReceive() returns, the Alarm Manager releases this wake lock.


1 Answers

You probably want to have a closer look at the AlarmManager.cancel(PendingIntent operation) function.

like image 121
Julian Avatar answered Oct 27 '22 15:10

Julian