Closed mebencomo closed 3 years ago
2021-02-15 11:04:50.353 15693-15778/? W/System.err: at com.google.android.gms.wearable.Wearable.getDataClient(Unknown Source:5) 2021-02-15 11:04:50.353 15693-15778/? W/System.err: at com.github.guikeller.cordova.wearos.CordovaWearOsPlugin.registerWearableMessageListener(CordovaWearOsPlugin.java:129) 2021-02-15 11:04:50.353 15693-15778/? W/System.err: at com.github.guikeller.cordova.wearos.CordovaWearOsPlugin.registerMessageListener(CordovaWearOsPlugin.java:89)
// L129
Wearable.getDataClient(context).addListener(new DataClient.OnDataChangedListener() {
...
}
Are you importing the following libs?
implementation 'com.google.android.gms:play-services-base:+'
implementation 'com.google.android.gms:play-services-wearable:+'
Source: https://stackoverflow.com/questions/58202877/error-while-accessing-android-wear-data-layer
Hi! Thanks for the answer. Yes, I'm importing those libs. Here is my cordova app build gradle:
/*
* WARNING: Cordova Lib and platform scripts do management inside of this code here,
* if you are adding the dependencies manually, do so outside the comments, otherwise
* the Cordova tools will overwrite them
*/
dependencies {
implementation fileTree(dir: 'libs', include: '*.jar')
// SUB-PROJECT DEPENDENCIES START
implementation(project(path: ":CordovaLib"))
implementation "com.google.android.gms:play-services-base:+"
implementation "com.google.android.gms:play-services-wearable:+"
// SUB-PROJECT DEPENDENCIES END
}
I also use implementation 'com.google.android.gms:play-services-base:17.2.1'. But i got the same error
Did you also install the other plugins required?
cordova-plugin-androidx
cordova-plugin-androidx-adapter
cordova-android-play-services-gradle-release
Yes. I've following all the steps that you indicates.
In build.gradle:
// PLUGIN GRADLE EXTENSIONS START apply from: "../cordova-android-play-services-gradle-release/hellocordova-cordova-android-play-services-gradle-release.gradle"
I have an addionatl question: to test all project i'm using my phone (cordova app) and wear androind studio emulator, is that correct?
Hi @mebencomo
Q) To test the project I'm using my phone (Cordova app) and an emulated WearOS (Android Studio), is that okay? A) To be honest, I have never tested against the watch emulator / always used real devices. Would you be able to test against a real WearOS device?
Also, as the error message says the following:
2021-02-15 11:04:50.312 15693-15778/? I/CordovaWearOsPlugin: registerMessageListener 2021-02-15 11:04:50.352 15693-15778/? W/System.err: at com.google.android.gms.wearable.DataClient.(Unknown Source:3) 2021-02-15 11:04:50.353 15693-15778/? W/System.err: at com.google.android.gms.wearable.internal.zzcj.(Unknown Source:4) 2021-02-15 11:04:50.353 15693-15778/? W/System.err: at com.google.android.gms.wearable.Wearable.getDataClient(Unknown Source:5)
I wonder if there is any connection to this ( ? ) : https://developer.android.com/training/wearables/data-layer/migrate-to-googleapi
Do you have the "Wear OS" app installed on your mobile phone as well? Thinking out loud: I do not think that will work against the emulator (real mobile X emulated watch)
Hi @mebencomo
Any progress? :)
Hi! I have WearOS app in my phone. I've been using ADB command to connect my phone and the emulator.
They emulator see my phone like a node to deespach the Message. But the phone won't recive it.
The phone won't connect with the emulator.
Hi @mebencomo
I believe that is something to do with the emulator in the mix.
See this tutorial on how to do the emulator "Wearable Configuration" to talk to your phone. https://heartbeat.fritz.ai/connect-android-devices-with-an-android-wear-emulator-338c8e50e8a4
As you can see it is not quite like a walk in the park with the emulator in the mix. In addition to that keep an eye on the issue: #4
Cheers, Gui
Hi!!
It's working now! I was working with an old version for the emulator.
Thank you so much for your support!!
Hi @mebencomo
No worries, I am glad to hear that you managed to send/receive messages between your Cordova and WearOS app. Is there anything in the docs that needs better explaining?
Good luck with your project, cheers!
Hi! I'm working with your plugin in my project and it gives me this error. What could be happening?
Thanks!