【发布时间】:2015-07-16 08:15:28
【问题描述】:
感谢观看。当通知被触发时,我不想用新的通知替换以前的通知。就我而言,通知正在被替换。仅当用户按下 android 内置的清除通知选项时,才应清除通知。感谢小伙伴们的帮助。
这就是我尝试过的:
Intent notifyIntent =
new Intent(new Intent(this, Dashboard_DrawerMain.class));
// Sets the Activity to start in a new, empty task
notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
contentIntent = PendingIntent.getActivity(this, 0,notifyIntent
, 0);
mBuilder =
new NotificationCompat.Builder(this)
.setContentTitle(str_SenderName)
.setStyle(new NotificationCompat.BigTextStyle())
.setContentText(str_Message)
.setAutoCancel(true);
mBuilder.setSmallIcon(R.drawable.ft_icon);
mBuilder.setContentIntent(contentIntent);
mBuilder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION));
mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
【问题讨论】:
-
你用谷歌搜索了吗?您至少阅读过
NotificationManager.notify文档吗? -
@Selvin 谷歌?什么是谷歌?
标签: android android-notifications android-pendingintent