【问题标题】:NotificationListenerService WearableNotificationListenerService 可穿戴设备
【发布时间】:2015-02-16 22:34:47
【问题描述】:

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

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

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

我的问题是:

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

【问题讨论】:

  • 事实上,应用程序可以直接在手表上生成通知,这些通知不会出现在手机上 - 您的方法也不会接收到这些通知。
  • @ianhanniballake 是的,这是另一个问题。据我了解,我认为没有任何可能的解决方法。

标签: android android-notifications wear-os android-wear-data-api android-wear-notification


【解决方案1】:

是的,有可能,只需将 NotificationListenerService 中的 Notifications 过滤为公开的 FLAG_LOCAL_ONLY。 它由.setLocalOnly() 设置,如果为true,则不会向Wear 设备发送通知。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多