本文介绍了Moto 显示中的通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个通知,它可以工作,但在锁定时无法在 Moto Display 中显示.我更改了优先级、类别等,但没有任何影响.我想要这样的通知,比如消息或错过的电话:moto 显示
I created a notification and it works but not display in Moto Display when locked.I changed Priority, Category etc with no effects.I want this notification like messages or missed cals:moto display
这作为服务运行:
PendingIntent pendingIntent = PendingIntent.getActivity(this, requestCode /* Request code */, intent,
PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.emblem2)
.setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_help_red))
.setColor(getResources().getColor(R.color.colorFirst))
.setContentTitle(title)
.setContentText(location)
.setAutoCancel(true)
.setSound(defaultSoundUri)
.setShowWhen(true)
.setCategory(Notification.CATEGORY_ALARM)
.setLights(Color.YELLOW, 200, 200)
.setContentIntent(pendingIntent);
notificationBuilder.setVibrate((sharedPreferences.getBoolean("notifications_new_message_vibrate", false) ? new long[]{0, 300, 200, 300} : new long[]{}));
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(requestCode, notificationBuilder.build());
推荐答案
正如 Marcin 所指出的,Moto Display 不适用于通知小图标中的矢量可绘制.我遇到了同样的问题,更改小图标解决了问题.
As pointed out by Marcin, Moto Display doesn't work with vector drawable in notification small icon. I had the same problem and changing the small icon resolved the issue.
遗憾的是,像 Moto Display 这样出色的功能没有文档指出这一点.
It's sad that such a nice feature as Moto Display doesn't have a documentation pointing that out.
这篇关于Moto 显示中的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!