Reputation: 235
I have a basic media player app that works on android wear. I want to close wear app when user closes my app on mobile side? How can I do that? I have used too much time and couldn't find anything. How can I do that?
Thanks
Upvotes: 2
Views: 187
Reputation: 5741
Phone side: I assume you already are communicating with the wear device via GoogleApiClient (Wearable.API). If you are, you can use the MessengeApi to send a custom message across to your Wear app. (Just remember to add capabilites for both.) Easy directions are here.
Wear side: Just implement the MessageListener interface in your main activity. When the message comes in via onMessageReceived(), you can call finish(). Easy directions are here.
Finally, there is a Google Android Wear sample for the DataLayer. This covers sending Messages with other stuff if you want to dig into it.
Upvotes: 1