我正在使用全屏通知我的代码可以在Oreo
版本及以下版本中找到但是当我运行时android-Q
我遇到了异常
Use of fullScreenIntent requires the USE_FULL_SCREEN_INTENT permission
我正在使用setFullScreenIntent()
全屏通知
这是我的代码
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "123");
notificationBuilder.setAutoCancel(true)
.setColor(ContextCompat.getColor(this, R.color.colorAccent))
.setContentTitle(getString(R.string.app_name))
.setContentText("Test")
.setDefaults(Notification.DEFAULT_ALL)
.setWhen(System.currentTimeMillis())
.setFullScreenIntent(pendingIntent,true)
.setSmallIcon(R.drawable.ic_launcher_background)
.setAutoCancel(true);
mNotificationManager.notify(1000, notificationBuilder.build());