I have two android apps(mobile/watch), and I want to check on the mobile app if the wear app is installed on the watch or not.
Any thoughts?
I searched but no results.
It's described in Detect your app on another device , there is also a sample in Github .
In a nutshell, you should:
res/values/wear.xml
file to your watch module, specifying your app's capability:<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@array/android_wear_capabilities">
<string-array name="android_wear_capabilities">
<item>your_custom_app_capability</item>
</string-array>
</resources>
val capabilityClient = Wearable.getCapabilityClient(this)
capabilityClient.addListener({ capabilityInfo -> {
// the watch with the wear app that contains
// your custom capability can be retrieved from:
capabilityInfo.nodes
} }, "your_custom_app_capability")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.