0

I hope someone can help me. I can't seem to find anything that gives me a straight answer or that works.

So basically on my Phone app the user enters their age which I will then save and pass to the Watch.

For now to get it working i'm just using a hardcoded int value.

So what I want the watch to do is when the user enters a certain activity on the watch that it will retrieve this value each time from the phone and be displayed.

Obviously I intend to do more than just display it but if I could get it displaying first it would mean that its being retrieved.

Can anyone help me? Thanks in advance.

2 Answers2

0

Take a look at http://developer.android.com/training/wearables/data-layer/index.html and choose accordingly to your context the appropriate API(s).

Aladin Q
  • 550
  • 5
  • 12
  • I've had a look at those and I'm unsure as to which I should use for the watch to instigate the call on start to retrieve the integer variable from the device. – user3498416 Apr 04 '15 at 17:49
  • I've actually followed these tutorials but it seems the data isnt being recieved judging by the log. http://android-wear-docs.readthedocs.org/en/latest/data.html – user3498416 Apr 05 '15 at 15:58
0

In said activity on the watch, implement GoogleApiClient. In the onConnected() method send a message to your phone via Wearable.MessageApi.sendMessage Assuming you want to retrieve this information from the phone while the app is not open on the phone, use a WearableListenerService on the phone to receive the message. Now you have successfully told the phone you want info! Simple gather the info you need while still in the WearableListenerService and send another message back to the watch via Wearable.MessageApi.sendMessage

Let me know if you have any more questions

Benjamin
  • 76
  • 4
  • Got that working thanks. Good you explain to me why my open on phone function has now stopped working? I read you can't have multiple GoogleApiClients. Is there a way around this to now get that working when the user clicks the button. – user3498416 Apr 10 '15 at 11:23