1 问题
app,自定义消息通知的时候,在Android8.0手机上收不到通知
2 解决办法
NotificationManager需要创建NotificationChannel,然后调用createNotificationChannel把NotificationChannel传递进去,并且通过setChannelId设置相应的id
3 普通样本代码实现
private static final String ID = "PUSH_NOTIFY_ID";private static final String NAME = "PUSH_NOTIFY_NAME";public int id = 0; public NotificationManager manager;public void showMessage() {manager = (NotificationManager) mContext.getSystemService(mContext.NOTIFICATION_SERVICE);NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext);if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {NotificationChannel mChannel = new NotificationChannel(ID, NAME, NotificationManager.IMPORTANCE_LOW);manager.createNotificationChannel(mChannel);