NotificationListenerService Wearable

会有一股神秘感。 提交于 2019-12-11 23:44:09

问题


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

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

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

My issue is:

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


回答1:


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.



来源:https://stackoverflow.com/questions/28469863/notificationlistenerservice-wearable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!