我正在开发一个应用程序,我必须弹出一些提醒通知。对于这个要求,我已经开发了代码。我的代码工作正常。但问题是,当我杀死应用程序(设置 - >应用程序 - >管理应用程序 - >应用程序 - >强制关闭)时,它不会触发事件。为什么它发生这样的任何人都有任何想法.. ??
在android Manifest文件中我添加了:
<接收器android:process =“:remote”android:name =“。AlarmReceiver”/>
这是我的代码:
Intent intent = new Intent(getApplicationContext(), NotificationHandler.class);
// Setup the intent to handle calling our receiver
PendingIntent sender = PendingIntent.getBroadcast(getApplicationContext(), RXMIND_TAKE, intent, PendingIntent.FLAG_UPDATE_CURRENT);
// This is important because we want to grab the next 15 mintue
// interval to fire the handler at. We will then set the repeats
// to 15 minutes for the reoccurnce
Date interval = Timeer.getFifteenMinuteInterval();
// Get the AlarmManager service
AlarmManager am = (AlarmManager)getApplicationContext().getSystemService(Activity.ALARM_SERVICE);
// Setup the handler then set the repeats to 15min. This will hit exactly on the 15 minute
// interval for every hour
am.setRepeating(AlarmManager.RTC_WAKEUP, interval.getTime(), AlarmManager.INTERVAL_FIFTEEN_MINUTES, sender);