Skip to content Skip to sidebar Skip to footer

Wearablelistenerservice Onmessagereceived Is Not Called On Device

I am trying to send a simple message from my Android wear app to my phone app using the Wearable.MessageApi. This is my onConnected callback from GoogleApiClient on the Wear devic

Solution 1:

Oh, good god.. I figured out my problem. I THOUGHT the applicationId was the same, but it turned out that I never set up build flavors on the wear module, so the two applicationIds were actually com.example.android and com.example.android.dev..

Hope this helps other people who ran into the same problem as me :\

Solution 2:

I was having the same issue, due to (very) poor and outdated documentation on the Android Developer website. I was adding a Wear app to an existing app that's been around for years. As such, I have been using a custom debug.keystore for years now in my main app.

When I made the Wear app, I did not update the build.gradle to use the same debug.keystore file as the regular app - once I did that, I started receiving messages from the Watch -> Phone!

Here is a checklist to review if you're having the same issue as me and the OP:

  1. Wear and Phone apps need same applicationId
  2. Same versionNumber and versionName between apps
  3. Signed by the same key (this was what fixed my issue)

I just copied the "signingConfigs" section from my app's build.gradle to the wear app's build.gradle

signingConfigs { debug { storeFile file('../app/debug.keystore') } }

This issue cost me an entire day, hopefully someone else finds this useful.

Solution 3:

Another possible trap, in your WearableListenerService, don't forget the call to super:

@OverridepublicvoidonCreate() {
    super.onCreate(); // <-- don't forget this
    ...
}

Post a Comment for "Wearablelistenerservice Onmessagereceived Is Not Called On Device"