Search code examples
androidgoogle-apiandroid-servicewear-osandroid-wear-data-api

Andorid Wear - Start Mobile Service on Watch Face Set


How do I start a standard Service on my mobile device from a watch face? Would I need to use the Message API? If so, what would be the correct way of doing this? I currently only start the Service on the mobile's boot and when I open the config activity.


Solution

  • Yes, you'll need to use the Message API. You'll find it well documented at https://developer.android.com/training/wearables/data-layer; if you subclass WearableListenerService on the handheld, it will start automatically when a message is sent from the watch. This could be your existing service (just change it from extends Service to extends WearableListenerService), or you could leave your existing service unchanged and start it from the new WearableListenerService when a message arrives.