1

I've got an app that utilizes a Wearable and am using the Listener Service, sending messages and synchronizing DataItems in between. This app does not have to use a Wearable. What I want to know is if my app should always check if a Wearable is connected before deciding if I should send data/messages?. If yes, what is the best way to check if Wearable is connected. Thank you very much!

nono_exe
  • 23
  • 5
  • I think it is a required step to check if there is any connected device before sending `dataItems`. There is a sample - [Data Layer Sample](https://github.com/googlesamples/android-DataLayer), this shows how to work with a `WearableListenerService`, to produce and consume `DataEvents` and effectively work with the `DataLayer` – Mr.Rebot Nov 13 '18 at 21:21
  • One question to ask yourself is: what is the desired behavior if the user connects a wearable _after_ your phone app has run? Would you want the data from the phone app to appear on the watch? If so, then you do **not** want to check for connectivity - write the `DataItems` unconditionally so that they will available if/when your watch app is run, now or later. OTOH, if your data sync only makes sense if both devices run your app concurrently, then you probably **do** want to check for connectivity. – Sterling Nov 18 '18 at 02:47

0 Answers0