Android 实现点击清理通知而不清理通知栏的通知解决办法
NotificationCompat.Builder builder=new NotificationCompat.Builder(appContext, CHANNEL_ID) .setSmallIcon(appContext.getApplicationInfo().icon) .setContentTitle(title) .setTicker(content) .setContentText(content) // .setOngoing(true)//通知不会被清除通知所清理 .setWhen(System.currentTimeMillis()) .setAutoCancel(true) .setContentIntent(pendingIntent);
设置setOngoing(true)即可