折腾了很久
点击Notification 不跳转
除了Android 26以上 设置channel id 还有个比较细的点,没有注意
if (Build.VERSION.SDK_INT >= 26) { channel = new NotificationChannel("my_channel_02", "MyMsg", NotificationManager.IMPORTANCE_HIGH); if (nm != null) { nm.createNotificationChannel(channel); } }
这里的my_channel_02 这里的channel Id
必须要和 Notification Builder的id一致
Notification notification = new NotificationCompat.Builder(context, "my_channel_02") .setDefaults(Notification.DEFAULT_SOUND) // .setOngoing(true) .setSmallIcon(R.mipmap.ic_app_icon) // the status icon .setColor(Color.GREEN)
不然就会报 channel id 没找到的bug 飘红
标签:02,Notification,跳转,Activity,Android,id,channel From: https://www.cnblogs.com/fengfenghuifei/p/17833477.html