清除 RAM 停止显示通知

Clearing RAM stop showing Notifications

使用 AlarmManager class 我可以在 200 毫秒后安排通知(用于测试)代码:

Intent alarmIntent = new Intent(this, AlarmReceiver.class);
pendingIntent = PendingIntent.getBroadcast(this, 0, alarmIntent, 0);
manager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
int interval =200;
manager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),interval, pendingIntent);
public class AlarmReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context arg0, Intent arg1) {
   SetUpNotification.createNotification();

}}

但是当我清除 RAM 时,这些通知会停止,即使我关闭 activity 我也能收到这些通知,但在清除 ram 后没有,我不知道我在做什么错误,请帮助

MIUI 解决方案 7.0 => 安全 => 自动启动 => select 你想要 运行 在后台运行的应用程序 => 重启 重启后你的设备应该能够像其他 android 设备一样在后台 运行 您的应用程序服务。

MIUI 4.0 settings

MIUI AutoStart Detailed Description