Android O Notification导致setLights()被弃用,setLightColor()会眨眼吗?

Android O Notification导致setLights()被弃用,setLightColor()会眨眼吗?

社区首页 >问答首页 >Android O Notification导致setLights()被弃用,setLightColor()会眨眼吗?问Android O Notification导致setLights()被弃用,setLightColor()会眨眼吗?ENStack Overflow用户提问于 2018-03-16 02:02:46回答 1查看 616关注 0票数 4我有这样的代码:

代码语言:javascript复制 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

NotificationChannel channel = new NotificationChannel("test", getString(R.string.notification_channel_news), NotificationManager.IMPORTANCE_HIGH);

channel.enableLights(true);

channel.setLightColor(Color.YELLOW);

channel.enableVibration(true);

channel.setVibrationPattern(pattern);

channel.setImportance(NotificationManager.IMPORTANCE_HIGH);

channel.setDescription("desc");

Log.e("notif", channel.shouldShowLights() + "");

if (notificationManager != null) {

notificationManager.createNotificationChannel(channel);

}

}

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, "test")

.setSmallIcon(R.mipmap.ic_launcher)

.setPriority(2)

.setContentTitle(messageTitle)

.setStyle(new NotificationCompat.BigTextStyle().bigText(messageBody))

.setVibrate(pattern)

.setLights(Color.YELLOW,5,5)

.setSound(defaultSoundUri)

.setContentIntent(pendingIntent);

Notification not = notificationBuilder.build();怎样才能像.setLights(Color.YELLOW,5,5)一样设置发光二极管的延迟时间?因为在android上,.setLights(Color.YELLOW,5,5)根本不能工作。

javaandroidandroid-notificationsandroid-8.0-oreo关注问题分享EN回答 1推荐最新Stack Overflow用户发布于 2019-09-04 10:48:55

你不能-看起来Android API不再允许自定义闪烁模式。

收藏分享票数 1EN页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持原文链接:https://stackoverflow.com/questions/49306339

复制相关文章

相关文章

标签打印机标签尺寸设置教程:详细步骤
365bet平台

标签打印机标签尺寸设置教程:详细步骤

📅 07-23 👁️ 1910
get新技能,“打铁”还需自身硬
28365365体育投注

get新技能,“打铁”还需自身硬

📅 10-14 👁️ 8121
随借随还贷款app推荐:灵活借款的5大优势解析
bet体育365冻卡么

随借随还贷款app推荐:灵活借款的5大优势解析

📅 10-26 👁️ 1146
oppo手机忘记锁屏密码怎么办?别慌,解锁秘籍在此!
28365365体育投注

oppo手机忘记锁屏密码怎么办?别慌,解锁秘籍在此!

📅 09-17 👁️ 8562
JonyJ究竟为什么叫豆芽?Dzknow和高天佐闹完Beef又和解!
bet体育365冻卡么

JonyJ究竟为什么叫豆芽?Dzknow和高天佐闹完Beef又和解!

📅 08-24 👁️ 1881
《塞尔达传说:王国之泪》amiibo每天可以刷几次?
bet体育365冻卡么

《塞尔达传说:王国之泪》amiibo每天可以刷几次?

📅 07-09 👁️ 7677