[英]Make app not deliver notifications to Android Wear
I have an app I'm working on that isn't yet compatible with Wear. 我有一个正在使用的应用尚未与Wear兼容。 Is there a way for me to block notifications from being delivered to a user's smart watch?
我有什么办法可以阻止将通知发送到用户的智能手表? The app has a persistent notification that I do not want to display until the wear module is ready.
该应用程序有一个永久性通知,在磨损模块准备就绪之前,我不想显示该通知。
If your using notification builder, there's an option to setLocalOnly. 如果您使用的是通知生成器,则可以选择setLocalOnly。
Development docs :'setLocalOnly(boolean localOnly) Set whether or not this notification should not bridge to other devices. 开发文档:'setLocalOnly(boolean localOnly)设置此通知是否不应桥接到其他设备。 '
“
Notification notification = new Notification.Builder(mContext)
.setContentTitle("New mail from " + sender.toString())
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail)
.setLargeIcon(aBitmap)
.setLocalOnly(true)
.build();
Not tested it from the phone but I know it works with stopping my wear notification appearing on the phone. 尚未通过电话对其进行测试,但我知道它可以阻止我的磨损通知显示在电话上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.