NotificationListenerService可穿戴 [英] NotificationListenerService Wearable

本文介绍了NotificationListenerService可穿戴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一种方法来检测发送到android可穿戴设备的通知。

I am trying to implement a way to detect the notifications that are sent to the android wearable devices.

在谷歌搜索之后,我发现无法在可穿戴设备上使用NotificationListenerService。

After googling around, I have found it is not possible to use notificationListenerService on the wearable.

当前实现,我已经在移动手持设备上实现了notificationListenerService,并且正在使用DataLayer发送通知。

In current implementation, I have implemented the notificationListenerService on the mobile handheld and am using the DataLayer to send the notifications over.

我的问题是:

使用notificationListener,它可以检测出现的所有内容。是否有可靠的方法来检测将哪些通知发送到可穿戴设备?例如,我不希望在dataLayer上发送暮光之城或其他未发送到可穿戴设备的东西

With the notificationListener, it detects everything that appears. Is there a reliable way to detect which notifications will be sent to the wearable? For example, I don't want twilight or other things that are not sent to the wearable to be sent across the dataLayer

推荐答案

是的,有可能,只需通过NotificationListenerService < android.com/reference/android/app/Notification.html#FLAG_LOCAL_ONLY rel = nofollow> FLAG_LOCAL_ONLY 是公开的。
它是由 .setLocalOnly()设置的,如果属实,则不会将通知发送到Wear设备。

Yes, it is possible, just filter your Notifications in NotificationListenerService by FLAG_LOCAL_ONLY which is public. It is set by .setLocalOnly() and if it is true notification is not send to Wear device.

这篇关于NotificationListenerService可穿戴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆