恰好通过报警管理器通过一个应用程序设置报警什么,如果应用程序被卸载 [英] What happens to the alarms set via alarm manager by an app, if the app is uninstalled

查看:141
本文介绍了恰好通过报警管理器通过一个应用程序设置报警什么,如果应用程序被卸载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下code,从我的应用程序设置闹钟。

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 ?

推荐答案

您通过 AlarmManager 计划的事件时,定他们的应用程序卸载删除。

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

这篇关于恰好通过报警管理器通过一个应用程序设置报警什么,如果应用程序被卸载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆