简体   繁体   中英

Send Data from Android Wear to Android Mobile app

this is a generialized question. I am working on a Sample application to demonstrate the features of Android wear device.

In this I am working on synching data between mobile and wear. Here I am able to send message from

  1. App to Wear
  2. Wear to App

using sendMessage() method in MessageApi

But as for as Data

I am able to send data only from 1. App to Wear

I am not able to send data from 2. Wear to app.

using putDataItem() method using DataApi.

Have any others tried sending data from wear to app instead of from app to wear.

Also in the DataLayer sample of Wear, I could not see this implemenation.

https://developer.android.com/samples/DataLayer/index.html

the onDatachanged() method of data api will only be called when there is any data change.

So what I did was I was sending the same data, hence the data was not sent.

Now I was sending different data each time, and I get the call for onDataChanged() for DataApi.

Oops. My mistake. It may help others.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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