Is NodeApi specific to Android Wear?

浪子不回头ぞ 提交于 2019-12-12 03:19:15

问题


I want to detect the connected Android Wear device in my app. I found the solution here using NodeApi. But the documentation doesn't say anything about that is it specific to Android Wear or not:

Exposes an API for to learn about local or connected Nodes.

Node events are delivered to all applications on a device.

What is a Node here? Is it any device that connected over bluetooth or specific Android Wear device connected over bluetooth? I want to detect if the device connected is Android Wear device and get its display name. Any reference about this?


回答1:


The NodeApi is for Android Wear, but it is an API that can be used on the device side.

NodeApi.GetConnectedNodesResult nodes = 
    Wearable.NodeApi.getConnectedNodes( mApiClient ).await();

Then for each node within nodes, you can call getDisplayName().




回答2:


Sorry, that was my silly mistake. I found the package name : com.google.android.gms.wearable.NodeApi. So, yes; NodeApi is only for Android Wear.



来源:https://stackoverflow.com/questions/32793711/is-nodeapi-specific-to-android-wear

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