を却下された私は、通知が(ステータスバー上に表示)アクティブであるかどうかを確認するには、以下の方法を書いた通知した後、周りのスティック(同じ 'intentPopup'と 'id'がこのPendingIntentに渡されます)、FLAG_NO_CREATEのために、このPendingIntentがまだ存在しない場合はnullになると思います。私はこの方法について、ここ数年前に投稿されたスレッドで読んだ。PendingIntentは
通知がまだ発行されていない場合、メソッドは期待値(false)を返します。通知が発行され、ステータスバーにある場合、このメソッドはtrueを返します。
ただし、通知を閉じた後でも、PendingIntentがまだ存在するかのように、このメソッドはtrueを返します。
私はここで何が欠けていますか? PendingIntentはまだ利用可能ですか、何かを誤解していますか?
特定の通知がアクティブである(ステータスバーに表示されている)かどうかを確認する良い方法はありますか?
編集:ここでは、通知を作成するコードです:Notification
が、却下閲覧、またはキャンセルされた場合、あなたがNotification
に埋め込む
Intent intentPopup = new Intent(context, PopupActivity.class);
intentPopup.putExtra("id", id);
intentPopup.putExtra("timeQ", timeQ);
PendingIntent pendingIntentPopup = PendingIntent.getActivity(context, id, intentPopup, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setContentIntent(pendingIntentPopup)
.setSmallIcon(R.drawable.q_notification_icon)
.setContent(contentView)
.setSound(Uri.parse("android.resource://" + context.getPackageName() + "/raw/notification_sound"))
.setVibrate(vibrate_pattern);
Notification notification = mBuilder.build();
notification.flags |= Notification.FLAG_NO_CLEAR;
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(id, notification);
「通知」を作成するために使用するコードを投稿してください。 –
@DavidWasser掲示されている。 –