[英]Multiple notifications not working on Android
每當我在Android上收到推送通知時,它都會替換抽屜中任何現有的通知。 有什么辦法解決嗎?
下面是我的代碼:
NotificationManager notificationManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
Intent intent = new Intent(DbInsertService.this, MessageActivity.class);
intent.putExtra("Service",serviceType);
PendingIntent pIntent = PendingIntent.getActivity(DbInsertService.this, (int)
System.currentTimeMillis(), intent,PendingIntent.FLAG_UPDATE_CURRENT);
Notification n = new Notification.Builder(DbInsertService.this)
.setContentTitle("Message from " +serviceType.getSer_name())
.setContentText(messageType.getHis_title())
.setSmallIcon(R.drawable.ic_email_variant_grey600_24dp)
.setContentIntent(pIntent)
.setAutoCancel(true).build();
notificationManager.notify(0, n);
謝謝
為不同的通知設置不同的ID。
notificationManager.notify(0, n);
//在此設置不同的ID。
您要發送的所有ID都相同。 發送不同的ID,它們不會被覆蓋。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.