Mariuxtheone / Teleport

Data Sync & Messaging Library for Android Wear
370 stars 47 forks source link

Send message from service #28

Open ghost opened 9 years ago

ghost commented 9 years ago

It is possible to receive a messages and open activities from a services. But can you also send a response message in a service. I want to be able to get data from the phone to the wearable, without the app being opened on the phone.

XLpacman805 commented 9 years ago

I'm trying to do something very similar, except I want data from the wearable to the phone, without the app being opened on the phone.

thedamfr commented 9 years ago

There is no reason it shouldn't work. Send a Message to the service to make it start.

ghost commented 9 years ago

Sending a message to the service to start an activity work very well. But how can you send a message to a service that needs to get data from a database and then send back a response to the wear with the data. Keeping in mind that this has to be done without the mobile app being opened.

thedamfr commented 9 years ago

Send a message to the service. The message must include parameters. Have the service fetch your data and put them in the datamap then. You should have a service or something on the wear app that listen for change on the data map. Then you are done.

Todo list :

  1. Wear app listen to dataMap
  2. Wear app send message to Mobile App's Service
  3. Mobile App Service fetch datas
  4. Mobile App Service put datas in DataMap
  5. Wear app get notified of dataMap changed

Did I answer your question ?

ghost commented 9 years ago

Thanks for the explanation! I think the problem where im stuck in is around step 4 and 5. I made a simple test app for trying to implement this setup. Is it possible for you to review my code?

thedamfr commented 9 years ago

You should submit a question on SO. There is no issue on Teleport here.

I will answer you on StackOverflow if you put a question there.

ghost commented 9 years ago

http://stackoverflow.com/questions/31165064/android-wear-send-response-from-service