kotlin: What is the best way to know if there is a wearos device connected to the phone and if it has a specific app installed?

0

Issue

I look for this but not solution works for me. Any idea how to make this posible?

I have an Android app written in kotlin, which has a version for wearOS.
In the iOS version I have been able to determine if it has an AppleWatch connected to the ipnone and check if the application is installed in the watch or not, to invite the user to install it if there’s no installed.

When trying to do something similar in the Android version, I have tried all the options that I have found on the net, but none of them work as I need:

1 – I have managed to detect if a device is connected to bluetooth and if it includes the word watch in its name. However, this does not guarantee that this watch is wearOS.

2 – I also have tried to detect if the wearos app is installed on the phone, however watches with the Galaxy watch 4 use their own app, so this solution does not help me, especially since the galaxy watch app is used to other watches with tizen and not wearOS.

3 – I have tried to detect if the app is installed on the watch, which I have not been able to do. But even in that case I can’t tell if it’s because the user hasn’t installed it (which is what I’m looking for) or that the watch isn’t compatible with wearOS.

My idea is check if there’s a wearOS device conected to the phone, if is conected check if my app is installed on it and if not “invite to install it”

Has anyone had to do something similar? How have you solved it?

Thanks in advance.

Solution

You should be able to use the NodeClient to see if there is a wear device connected to your mobile.

https://developers.google.com/android/reference/com/google/android/gms/wearable/NodeClient

And then use CapabilityClient to see if you app is installed and advertising and agreed capability.

https://developers.google.com/android/reference/com/google/android/gms/wearable/CapabilityClient

If it’s an unrelated app then you likely can’t check whether it is installed remotely.

Answered By – Yuri Schimke

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More