Ok、
おそらく別の奇妙なAndroidの文書化されていない癖ですが、通知にフラグを追加すると、かなり奇妙なことがわかります...
私がこれを行う場合:
Notification notification = new Notification(R.drawable.status_icon, "[Ticker Text]",System.currentTimeMillis());
PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, CarparkScreen.class), 0);
notification.setLatestEventInfo(AlertService.this,"[Title]", "[Detail]", intent);
mNM.notify(NOTIFICATION_BREACH, notification);
次に、通知が1回限りとして表示され、[キャンセル]をクリックすると、通常の方法で通知をクリアできます。
ただし、これらのフラグを追加した場合
Notification notification = new Notification(R.drawable.status_icon, "[Ticker Text]",System.currentTimeMillis());
PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, CarparkScreen.class), 0);
notification.setLatestEventInfo(AlertService.this,"[Title]", "[Detail]", intent);
notification.flags = Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE | Notification.DEFAULT_LIGHTS;
mNM.notify(NOTIFICATION_BREACH, notification);
進行中のフラグがないにもかかわらず、進行中の通知を作成します!!
これを引き起こしているのは実際にはDEFAULT_VIRBATEフラグだと思います。これは、最初はバイブレーション権限がなかったためですが、今はそれを追加しましたが、それでも通知は継続されます。
うーん!!!!
他の誰かがこれを再作成できますか?このような明らかなユースケースは、バグまたは癖のようです。
上記の非進行中の通知を作成しようとすると同時に、実際には進行中の通知を使用していますが、NotificationManager以外のすべての新しいインスタンスを使用しているため、これが原因になることはありません。上記のコードのIDも、進行中の通知とは異なります。
どんなアイデアでも大歓迎です!:)
アンディ。