在魅族手机android系统5.1上不显示
sheng930920 opened this issue · comments
在魅族手机android系统5.1上不显示
if (Build.VERSION.SDK_INT < 21 || headsUp.getCustomView() != null || !headsUp.isActivateStatusBar()) {
isPolling = true;
show(headsUp);
} else {
//当 系统是 lollipop 以上,并且没有自定义布局以后,调用系统自己的 notification
isPolling = false;
notificationManager.notify(headsUp.getCode(), headsUp.getBuilder().setIcon(headsUp.getIcon()).build());
}
自定义布局 || setActivateStatusBar(false)
博主,有没有办法,搞MIUI的系统。qq,微信是怎么搞的
直接使用5.0 以上的api.看readme
是直接使用5.0以上的API,还是无法弹出来,红米2a。5.1.1,MIUI8.
NotificationManager systemService = (NotificationManager)MainActivity.this.getSystemService(Context.NOTIFICATION_SERVICE);
final Notification.Builder notif = new Notification.Builder(MainActivity.this)
.setContentTitle("ssss")
.setContentText("dddddddd")
.setSmallIcon(R.drawable.abc_ab_share_pack_holo_dark) //ok
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher))
.setPriority(Notification.PRIORITY_HIGH); //does not seem to make a difference
if (Build.VERSION.SDK_INT >= 21) {
notif.setVibrate(new long[0]);
systemService.notify(222, notif.build());
}
设置 应用 里面要打开 悬浮通知 的开关
qq 微信这种用户量大的社交聊天app,估计国产安卓ui都自动开启了 悬浮通知 的开关