Bad notification for startForeground

逃离我推掉我的手 2024-04-18 16:24 137阅读 0赞
  1. if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
  2. //修改安卓8.1以上系统报错
  3. NotificationChannel notificationChannel = new NotificationChannel(
  4. //如果使用中的设备支持通知灯,则说明此通知通道是否应显示灯
  5. CHANNEL_ONE_ID, CHANNEL_ONE_NAME, NotificationManager.IMPORTANCE_MIN);
  6. notificationChannel.enableLights(false);
  7. notificationChannel.setShowBadge(false);//是否显示角标
  8. notificationChannel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
  9. NotificationManager manager = (NotificationManager)
  10. getSystemService(NOTIFICATION_SERVICE);
  11. manager.createNotificationChannel(notificationChannel);
  12. builder.setChannelId(CHANNEL_ONE_ID);
  13. }

发表评论

表情:
评论列表 (有 0 条评论,137人围观)

还没有评论,来说两句吧...

相关阅读