Уведомление, вызываемое AlarmManager НЕ всплывать при закрытии приложения
Для пользовательского приложения напоминания я используюAlarmManager
а такжеPendingIntent
установить конкретное время для моегоNotification
всплывать.
У меня есть мойNotificationManager
вReceiverActivity
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_alarm_receiver);
String ns = Context.NOTIFICATION_SERVICE;
NotificationManager mNotificationManager = (NotificationManager)
getSystemService(ns);
Context context = getApplicationContext();
CharSequence ticker = "You have notification";
CharSequence contentTitle = "My Reminder";
CharSequence contentText = "Reminder Content";
Notification notification = new Notification(R.drawable.notif_icon,
ticker, System.currentTimeMillis());
Intent notificationIntent = new Intent(this,
AlarmReceiverActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText,
contentIntent);
final int HELLO_ID = 1;
mNotificationManager.notify(HELLO_ID, notification);
}
ReceiverActivity выскакивает в указанное время плюс уведомление в панели уведомлений (вверху слева), и все в порядке. Но это не так удобно для пользователя, я хочу, чтобы только уведомление появлялось на панели уведомлений без каких-либо действий, появляющихся, когда приложение закрыто (где в реальных ситуациях, вероятно, закрыто во время вашего напоминания)