알림 바에 다른 알림을 게시하려고합니다.작업 완료시 명확한 알림을 피하는 방법
모두 ID가 다르지만 의도는 동일한 활동을 타겟팅합니다.
첫 번째 알림을 클릭하면 활동이 시작되고 완료되면 클릭합니다.
내 활동이 완료되면 막대에 남아있는 모든 알림이 사라집니다.
알림 표시 줄에 계속 나타나기를 바랍니다.
어떻게해야합니까?
여기 코드가 있습니다.
mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
int id = 10;
notificationIntent = new Intent(context, MyAct.class); // creating intent.
notificationIntent.putExtra("data", data);
notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// defining actions while notification.
contentIntent = PendingIntent.getActivity(context, id,notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
notification = new Notification(R.drawable.icon, message,
System.currentTimeMillis());
notification.setLatestEventInfo(context, "Hello", message,
contentIntent);
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notification.defaults |= Notification.DEFAULT_SOUND;
mNotificationManager.notify(id, notification);
id++;
미리 감사드립니다 ....!
ID의 활동 기반에서 알림을 수동으로 취소하고 있습니다. – Noby