更新时间:2022-12-30 07:58:12
自从 Wear OS 2.0 以来,没有办法完全自动化这个.谷歌全力以赴地提出独立"的想法.Wear 应用程序,让我们这些集成应用程序的开发人员大部分都被冷落了.
据我所知,自 Wear 2.0 以来安装这两个应用程序的唯一方法是如下流程:
RemoteIntent.startRemoteActivity()
为他们提供一个操作,以打开手表上的 Play 商店并访问您的应用列表.您需要在手表应用中执行类似的操作,以防用户先安装并运行它.
此过程记录在此处(带有一些代码示例):https://developer.android.com/training/wearables/apps/standalone-apps#detecting-your-app
I've released my Android and WearOS apps as separate APKs using the Google Play Console Multi-APK delivery method.
Both apps are discoverable when browsing from the respective device - Android app on phone and WearOS app on the watch. Additionally, when the phone app is installed on the Android device, I can see on my WearOS device that I can install the companion app on the "Apps on your phone" screen in Play Store app.
The official Google's WearOS documentation states the following:
On devices running Wear 2.0, when a user installs a phone app that has an associated watch app (either an embedded APK or an APK uploaded via the Play Console), the user gets a watch notification about the available watch app. Tapping the notification opens the watch Play Store, giving the user the option to install the watch app.
However, nothing happens when the Android app is installed on the phone. Moreover, user is not aware that the app has the WearOS companion app since it's not visible on the phone Play Store app or the website. The same goes for the watch - when user discovers my app from their WearOS device and installs it, the phone counterpart is not installed nor the user is notified of it.
The WearOS app is not standalone so it requires phone app to function. It has the same package name and is signed with the same key. All the notifications are allowed on the watch and on the WearOS app on the phone.
So, is there a way to automate the WearOS app installation or at least let user know that they can install it? Thanks!
Since Wear OS 2.0, there's no way to fully automate this. Google went all-in on the idea of "standalone" Wear apps, and left us developers of integrated apps mostly out in the cold.
As far as I know, the only way to get both apps installed since Wear 2.0 is a process flow like the following:
RemoteIntent.startRemoteActivity()
.And you need to do something similar in your watch app, in case the user installs and runs that first.
This process is documented (with some code samples) here: https://developer.android.com/training/wearables/apps/standalone-apps#detecting-your-app