0

I'm working on an android wear app that exchanges some information (using the Wearable Data Layer API) with a another android app installed in the phone device .

But if the Phone app is not running or the phone is locked the information cant be exchanged.

Basically I don't wont to look to my phone when I'm using my wearable device(Smartwatch).

any solutions ?

Thank you !

Hr.SAAD
  • 35
  • 6

1 Answers1

1

You will basically need to implement a WearableListenerService. You can find more on the section With a WearableService here.

This will spin up a service on the Android device to which you can communicate to. Don't forget to add the permission in the AndroidManifest.

<service android:name=".DataLayerListenerService">
  <intent-filter>
      <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
  </intent-filter>
</service>

Btw a handy library that gets away a lot of the boilerplate is Courier

timr
  • 6,668
  • 7
  • 47
  • 79
  • Thank you @tim , the Phone App is actually a Cordova App and as I now, we can't implement a Cordova plugin witch contains a WearableListenerService that works on the background . any other ideas ? – Hr.SAAD Nov 10 '15 at 19:54