通知が数秒後に消えることはありません。数秒後にAndroidのヘッドアップ通知が消える
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
builder.setSmallIcon(R.drawable.cast_ic_notification_small_icon)
.setDefaults(Notification.FLAG_ONGOING_EVENT)
.setPriority(Notification.PRIORITY_HIGH)
.setContentTitle(notificationDetails.getSubject())
.setContentText(notificationDetails.getMessage())
.setColor(context.getResources().getColor(R.color.colorPrimary))
.setOngoing(true);
とFLAG_ONGOING_EVENTとメソッドsetOngoing(true)を設定: だから私はこのような通知を作成しています。
ただし、数秒後に通知は消えていきます。 通知が消えるのは、ユーザーがクリックしたときだけです。 ありがとうございます。
AFAIK、これは不可能です。 – CommonsWare