WearableListenerService onMessageReceived is not called on device

陌路散爱 提交于 2019-11-29 13:55:11

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 :\

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!