I want to request some data from my app when my wear app launches. This data should then be sent back to the wear app to display. I'm struggling to understand how to implement WearableListeners or DataItems or where to implement them!
Another requirement would be that the phone app does not need to be open to send a receive data, would this be a service? A WearableService class that sits in the app module?
To give this some context, the wear app requests data (and sends the users location to the app service), the phone app receives this and does a Google Places API request at the user's location to get nearby markers. These markers should then be transported back to the wear app which receives them and displays them.
Could somebody detail how this structure should work, clearly defining the actual class name to use and in which module (app or wear) that part of the flow should sit?
(I should note, I managed to get a message sent from one device to the other and displayed in the logs, however it never hit the onMessageReceived event, I followed this tutorial - I've also seen this question, can I use something like this (even if the app is closed?)? It doesn't seem suitable as my wear app would require a guaranteed delivery given the fact it relies on markers on the map)
I also found this answer very useful but need more detail about the implementation.
I managed to do what I wanted using this guide: http://android-wear-docs.readthedocs.io/en/latest/sync.html which explains how to send a message from the phone to a wear device.
I then also used the Google Maps for Wear sample application to set up the map: https://github.com/googlemaps/android-samples/blob/master/AndroidWearMap/Wearable/src/main/java/com/example/androidwearmap/MainActivity.java
Using these two guides, I send a JSON Object converted to a string that contains all the information I need to display on my markers, such as title, snippet and the location of the marker. I then restructured the string in the Wearable app and pull the information out of it and add it to a new MarkerOptions object (which is then added to the map).