4
我在我的android應用程序中顯示多個通知。在摺疊模式下顯示多個通知第二個通知Android
當有單個通知它顯示正確。
但是,當我產生第二通知,默認情況下崩潰顯示第二個通知。
如果我手動展開第二個通知則顯示爲:
我想用默認值顯示在擴展模式下的通知。
這裏是我的代碼:
int num = (int) System.currentTimeMillis();
PendingIntent pendingIntent = PendingIntent.getActivity(this, num /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle();
bigTextStyle.setBigContentTitle(title);
bigTextStyle.bigText(messageBody);
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.corco)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setStyle(bigTextStyle)
.setContentIntent(pendingIntent);
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(num /* ID of notification */, notificationBuilder.build());
我這麼想嗎?或做錯了什麼?
在此先感謝。