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

2017-09-13  本文已影响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 才能显示。

上一篇 下一篇

猜你喜欢

热点阅读