美文网首页
oppo 自定义通知栏,无法显示

oppo 自定义通知栏,无法显示

作者: 涂鸦啦 | 来源:发表于2017-09-13 14:59 被阅读0次

背景

测试OPPO手机的时候发现有弹出通知,却没有在通知栏中显示。

解决方法

Notification notification = new Notification.Builder(context)
                    .setContentTitle(data.title)
                    .setContentText(data.describe)
                    .setSmallIcon(R.mipmap.floatwnd_icon)
                    .setLargeIcon(largeicon)
                    .setContentIntent(clickIntent)
                    .setContent(remoteViews)
                    .build();
            notification.flags = Notification.FLAG_AUTO_CANCEL | Notification.FLAG_ONGOING_EVENT;
            nm.notify(data.id, notification);

Notification的Flag需要加上Notification.FLAG_ONGOING_EVENT
并且需要设置通知栏的ICON 才能显示。

相关文章

网友评论

      本文标题:oppo 自定义通知栏,无法显示

      本文链接:https://www.haomeiwen.com/subject/jpaksxtx.html