1

I implemented a watchface compatible 1.x few months ago (2.x to come). The app has been thoroughly tested with the debug version on a real device, coupled with an emulator, but also on a moto 360 first generation. Everything was working like a charm. Both devices were communicating back and forth and the app is ready to be deployed. I did a last round of tests with the release build, installed on real devices as well: all good, The app was ready to be published!

I pushed an alpha version on the store for few alpha testers. And here appeared the issue: the phone is not interacting properly with the watch anymore. More specifically: the data is sent from the phone but the onDataChanged callback on the watch side does not seem to be called in this specific case. I really do not get it because the release build is perfectly working when I install it manually on my test device.

The data is sent (phone side):

  public static void putConfigDataItem(GoogleApiClient googleApiClient, final DataMap newConfig) {
      PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(DataLayerKeys.PATH_WITH_FEATURE);
      putDataMapRequest.setUrgent();
      DataMap configToPut = putDataMapRequest.getDataMap();
      configToPut.putAll(newConfig);
      Wearable.DataApi.putDataItem(googleApiClient, putDataMapRequest.asPutDataRequest()).setResultCallback(new   ResultCallback<DataApi.DataItemResult>() {
           @Override
           public void onResult(@NonNull DataApi.DataItemResult dataItemResult) {
               Timber.d("putDataItem result status: " + dataItemResult.getStatus());
           }
     });
  }

Data supposed to be received here (watch side), but not working:

public class HaikuService extends CanvasWatchFaceService {

  @Override
  public Engine onCreateEngine() {
    return new HaikuEngine();
  }

  private class HaikuEngine extends Engine implements DataApi.DataListener,
        GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {

        private final GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(HaikuService.this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Wearable.API)
            .build();

         //...

         @Override // DataApi.DataListener
         public void onDataChanged(DataEventBuffer dataEvents) {
         //... not called
         }

         //...
  }
}

Note: The wear and mobile modules have the same applicationId.

The Wearable.DataApi.putDataItem is not working in from the phone to the watch but Wearable.MessageApi.sendMessage is actually working. I am using it to communicate back and forth between the phone and the watch to grant the location permission at the first start and there everything is working as expected.

I have been looking all over the internet no way to find anything. Maybe I am missing something really obvious.. I have spent days on this issue and no way to find out. I would be eternally grateful to anyone who could help me or provide any tips.

Yumi
  • 11
  • 3
  • Since everything seemed to be working fine before you published it, did you used release key and not debug keys? – ReyAnthonyRenacia Jul 06 '17 at 10:01
  • I used the release key to push it on the store of course. Even if you try to push an APK signed with your debug key on the store, it gets refused. And the thing is, even if I make a release build with this exact same key and install it (without passing via the store, but using adb) it perfectly works! So I really really don't get it :( – Yumi Jul 08 '17 at 18:21

0 Answers0