简体   繁体   English

android Wear与移动数据通信

[英]android wear and mobile data comunication

I am trying to get my wearable app to communicate with my mobile app. 我正在尝试让可穿戴应用程序与移动应用程序进行通信。 what I want to have happen is my wearable app to update whenever it is started but the issue I'm having is that the mobile app has to be running as well. 我想发生的事情是我的可穿戴应用程序在每次启动时都进行更新,但是我遇到的问题是移动应用程序也必须同时运行。 but that seems redundant to me. 但这对我来说似乎是多余的。 I'm trying to display information on the wearable from the mobile app but if I have to have the mobile app running as well then what's the point in the wearable app; 我正在尝试通过移动应用程序在可穿戴设备上显示信息,但是如果我必须同时运行移动应用程序,那么可穿戴设备应用程序的意义何在;

I have looked into MessageAPI and DataApi examples and I can get them working but require both devices to be running. 我研究了MessageAPI和DataApi示例,可以使它们正常工作,但要求两个设备都在运行。 so I thought about looking into services. 所以我考虑研究服务。 I was thinking about having a background service to send updates to the wearable or the wearable be able to contact the service but I can't seem to get any results. 我当时在考虑让后台服务将更新发送到可穿戴设备或可穿戴设备能够与该服务联系,但我似乎无法获得任何结果。

Admittedly I'm still bit new at android and I have been trying to find a solution to this problem for a week. 诚然,我对android还是有点陌生​​,而且我已经尝试了一个星期的时间来解决这个问题。 I think I might be going about this wrong so I need some help to get pointed in the right direction and hopefully a good example. 我想我可能正在处理这个错误,因此我需要一些帮助来指出正确的方向,并希望是一个很好的例子。

Pro tip, read the docs docs... https://developer.android.com/training/wearables/data-layer/events.html 专业提示,请阅读文档文档... https://developer.android.com/training/wearables/data-layer/events.html

Wearablelistenerservice is what you want. Wearablelistenerservice是您想要的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM