我有通知兼容它创建新的通知任何打开的应用程序例如,如果打开10次应用程序创建10个通知请帮助我
public void Notifa(){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
String offerChanelsName ="Shop Now Offers";
String offerDescription ="Description Offer Names ";
int offerChaqnelImportan = NotificationManager.IMPORTANCE_DEFAULT;
NotificationChannel notificationChannel =new NotificationChannel(offerChannelId,offerChanelsName,offerChaqnelImportan);
notificationChannel.setDescription(offerDescription);
notificationManager.createNotificationChannel(notificationChannel);
}
builder = new NotificationCompat.Builder(context,offerChannelId);
builder.setSmallIcon(R.mipmap.ic_launcher)
.setAutoCancel(false)
.setCustomBigContentView(remoteViews)
.setOngoing(true)
.setContentIntent(pending);
notificationManager.notify(notifac_id,builder.build());
}
1条答案
按热度按时间bxgwgixi1#
tankyou@eugenpechanec根据文档,如果使用与以前相同的通知id调用notificationmanager.notify,则可以更新通知。只要你的notifac\u id没有改变,它就可以工作了