Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens to the alarms set via alarm manager by an app, if the app is uninstalled

I have the below code to set up an alarm from my app.

Intent intent = new Intent("MY_ALARM_NOTIFICATION");
intent.setClass(myActivity.this, OnAlarmReceive.class);
intent.putExtra("id", id);


PendingIntent pendingIntent = PendingIntent.getBroadcast(
                myActivity.this, Integer.parseInt(id),
                intent, PendingIntent.FLAG_UPDATE_CURRENT);

Calendar timeCal = Calendar.getInstance();
timeCal.set(Calendar.HOUR_OF_DAY, hour);
timeCal.set(Calendar.MINUTE, minutes);
timeCal.set(Calendar.DAY_OF_MONTH, day);
timeCal.set(Calendar.MONTH, month - 1);
timeCal.set(Calendar.YEAR, year);

Date date = timeCal.getTime();

AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
alarmManager.set(AlarmManager.RTC_WAKEUP, timeCal.getTimeInMillis(), pendingIntent);

What happens when I remove my application from settings ? Do the alarms remain ?

like image 420
tony9099 Avatar asked Oct 19 '13 11:10

tony9099


People also ask

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.

How do you trigger the alarm in flutter?

Alarm Bells Are Ringing The package exposes an AndroidAlarmManager object that has the following (relevant) methods: oneShot - trigger a one time alarm. oneShotAt - trigger a one time alarm at a specific date. periodic - trigger an alarm within a defined time interval.

What are alarms in Android?

Alarms let you send intents at set times or intervals. You can use alarms with broadcast receivers to start services and perform other operations. Alarms operate outside your app, so you can use them to trigger events or actions even when your app isn't running, and even if the device is asleep.


1 Answers

The events you schedule via AlarmManager are removed when the app that scheduled them is uninstalled.

like image 60
CommonsWare Avatar answered Nov 05 '22 17:11

CommonsWare