私は答えを求めて周りを見回しましたが、明らかな何かが欠けているに違いないと思います...
ユーザーがアプリで特定の操作を行うと、バーにアイコンを表示し、「メッセージ」ドロップダウンにメッセージを表示したいと考えています。
これは正常に機能しますが、(アクティビティ マネージャーを使用して) アプリをシャットダウンするか、電話を再起動すると、すべてがクリアされます。
アイコンは避けられないと思いますが、ユーザーがメッセージをクリアしたときにのみメッセージをクリアし、電話の再起動後もメッセージを持続させたいと思います。
これは可能ですか?
コード:
Notification notification = new Notification(icon, message, when);
notification.flags = Notification.FLAG_AUTO_CANCEL;
Context context = getApplicationContext();
CharSequence contentTitle = "Title";
CharSequence contentText = "The Message";
Intent notificationIntent = new Intent(this, MyActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
getNotificationManager().notify(STATUSBAR_ID, notification);