Show ongoing notifications in Android Wear

元气小坏坏 提交于 2019-12-03 07:10:14

问题


I've been playing around with Android Wear and making some dummy apps. What I've noticed is that Android Wear doesn't seem to show the notifications that are ongoing,i.e., notifications with setOngoing(true). Any way to show these notifications on Wear???


回答1:


On-going notifications will not show up on Wearable devices. Instead you have to implement a Wear App on the wearable and show cards from there.




回答2:


barkside's answer is correct. I recently wrote an article describing the steps in details, but basically:

  1. Create a wearable app with a service implementing WearableListenerService.
  2. Send a data item from the handheld app using the Data API.
  3. In the wearable app's service, handle receiving the data item & build an ongoing notification upon receipt.

A sample app is available here: https://github.com/doubleencore/WearOngoingNotificationSample

And step-by-step directions are available here: http://www.doubleencore.com/2014/07/create-custom-ongoing-notification-android-wear/




回答3:


Our notifications show up with setOngoing(true) and Service.startForeground but they didn't on the first day the SDK was out, might've been an update to the Android Wear Preview app?




回答4:


I haven't tried yet "playing" with Android Wear SDK, but I guess that if there is a way to make ongoing undismissable notifications - it should be in conjuction with the Service.startForeground() Service method.. exactly like it works with the hosting android device...




回答5:


If you using service to play music, Wear takes notification from RemoteControlClientCompat and keep it ongoing while music is playing. It will looks like Play Music does.



来源:https://stackoverflow.com/questions/22525772/show-ongoing-notifications-in-android-wear

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