guy-keller / cordova-wearos-plugin

Simple plugin that establishes a session with a WearOs Smartwach and helps exchange of messages between a cordova application and its WearOs Watch application and vice-versa.
2 stars 3 forks source link

Creating wearable app #4

Closed ragcsalo closed 3 years ago

ragcsalo commented 3 years ago

Dear @guikeller I've been missing out some years in WearOS development, and it seems things have changed a "bit". Do I have to create a standalone Wear OS app with the same package identifier, using the version numbering you described in the Readme? If I add the build to my existing Android app, will it be installed automatically when new users install my phone app?

I'm just trying to make a wear app that can display text from my Cordova app...

(Btw. thanks for the iOS Watch Connectivity plugin, it works like a charm!! :-) )

guy-keller commented 3 years ago

Hi @ragcsalo

Q1) Do I have to create a standalone Wear OS app with the same package identifier? A1) That is correct so you can distribute the standalone Wear OS app and Mobile app together. During the publishing process, you will then upload 2 APKs and if they don't have the same package id "Google says no".

Q2) Do I have to use the version numbering you described in the Readme? A2) I do not make the rules, but yes; you do have to follow something like that. https://developer.android.com/training/wearables/apps/packaging#distribution-to-2-0

Q3) If I add the build to my existing Android app, will it be installed automatically when new users install my phone app? A3) A notification will appear on the watch to the user saying that there is your app also available there.

F1) Thanks for the iOS Watch Connectivity plugin, it works like a charm! :) A) I am glad to hear that, much appreciated! Hopefully, the wearOS plugin will work for you too!

Cheers, Gui

ragcsalo commented 3 years ago

THANKS for your help! :-) Now I can send messages to the watch easily. :-)

However, messages from the watch are not received in the phone app. Also it's weird that as soon s I initialize the plugin, an "OK" message arrives from the watch even if it's not connected... Shall I add a receiver to the MainActivity of my phone app manually?

guy-keller commented 3 years ago

Hi @ragcsalo

I am glad to hear that you already got the "phone > watch" communication to work. From what I understand the only issue now is the communication "watch > phone".

Q1) it's weird that as soon as I initialize the plugin, an "OK" message arrives A1) When you call 'WearOsPlugin.registerMessageListener' for the first time the 'OK' message means that it is now listening. https://github.com/guikeller/cordova-wearos-plugin-source/blob/master/app/src/main/java/com/github/guikeller/cordova/wearos/CordovaWearOsPlugin.java#L80

Q2) Shall I add a receiver to the MainActivity of my phone app manually? A2) I think so, the "messageListener" should be a 'global' thing. The sequence is: "init > registerMessageListener > sendMessage".

I have never tried "init > sendMessage > shutdown" then "init > registerMessageListener". Is this a sample project? It would be great if you could push it to GitHub, if not some logs. 👍

Cheers, Gui

guy-keller commented 3 years ago

Hi @ragcsalo

Did you get it to work? I would recommend starting simple get the hang of things, make it work and go from there. As you can see from the issue - #3 - it all works fine, you will get there too.

Cheers, Gui