How does NodeAPI in Google Play Services work?

喜你入骨 提交于 2020-01-04 06:28:07

问题


I was trying to find the list of Nodes via getNodes() method in NodeAPI in GooglePlayServices.

I have one LG G Live watch, one Samsung Gear 2 (Tizen OS) and one Google Glass.

My LG G Watch has a connection with a companion APP (via GoogleAPIClient) on phone (Samsung S4). I have one application which checks if the watch is connected with phone, and if not connected, notify user about the same. I was using getNodes() method for this, and I connected glass and gear with phone with "My Glass" and "Gear Manager" (that's it). I was under the impression that both glass and gear would also get shown in getNodes() list, but only G Live came in the list.

So, now, I think that device must be connected with GoogleApiClient with phone (via a companion App), in order to show it as a node. That thing said, what if I am connecting Glass/Tizen with phone via GoogleApiClient but in other separate companion App on phone. Would it then show it as a node? Which brings me to the initial question, how do we define nodes in Google Play Services? and If it'll show them as nodes, how would I detect if it is a watch or glass or gear ( I can register devices for this issue, but I want to avoid that), I tried getDisplayName() and getId(), but both return same thing i.e. UUID of the node.


回答1:


Sorry to tell you man but google play services dont work for glass, but as I read your question i think you want to check if your glass/ watch is connected to the mobile or not, try to make bluetooth connection via socket for glass and unique ID would come. While for watch go ahead with play services.

I hope it helps.




回答2:


The Tizen device is not Android. Therefore, you will not be able to use the NodeAPI library with it. For how nodes are defined on an Android Wear device, you need to connect a GoogleApiClient and add a wearable listener in the following manner: Wearable.MessageApi.addListener(<GoogleApiClient name>, this);

Unfortunately, Glass does not support Google Play Services. You can follow this post for the latest on this topic.



来源:https://stackoverflow.com/questions/27547106/how-does-nodeapi-in-google-play-services-work

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