我知道如何通过设置振动通知来显示低于8.0设备的抬头通知.但是,运行Oreo的通知上的振动已被弃用.所以我去互联网搜索,有人说启用setVibrationPattern到通知通道将起作用.但遗憾的是,这不起作用.
所以这是我的代码.
Notification builder = new NotificationCompat.Builder(MainActivity.this) .setautoCancel(true) .setWhen(System.currentTimeMillis()) .setSmallicon(R.drawable.ic_androID_black_24dp) .setChannelID(ID) .setPriority(Notification.PRIORITY_HIGH) .setcolor(setActioncolor(counter)) .setcolorized(true) .setContentIntent(pendingIntent) .build();//Notification channel code.NotificationChannel chan2 = new NotificationChannel(SECONDARY_CHANNEL,getString(R.string.noti_channel_second),notificationmanager.importANCE_HIGH); chan2.setlightcolor(color.BLUE); chan2.setLockscreenVisibility(Notification.VISIBIliTY_PUBliC); manager.createNotificationChannel(chan2); manager.notify(notificationID,builder);解决方法 您还需要将“设置”中的应用程序通知设置设置为“紧急”.除非用户将应用程序设置为紧急,否则不会显示抬头通知. 总结
以上是内存溢出为你收集整理的android – 如何在奥利奥或更高版本中显示抬头通知全部内容,希望文章能够帮你解决android – 如何在奥利奥或更高版本中显示抬头通知所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)