android - 如何自动安装 WearOS 配套应用程序和 Android 手机应用程序

标签 android google-play wear-os google-play-console

我已使用 Google Play 控制台 Multi-APK delivery method 将我的 Android 和 WearOS 应用程序作为单独的 APK 发布.
从各自的设备浏览时可以发现这两个应用程序 - 手机上的 Android 应用程序和 watch 上的 WearOS 应用程序。此外,当手机应用程序安装在 Android 设备上时,我可以在我的 WearOS 设备上看到我可以在 Play Store 应用程序的“手机上的应用程序”屏幕上安装配套应用程序。
谷歌官方WearOS documentation声明如下:

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.


但是,当手机上安装了 Android 应用程序时,什么也没有发生。此外,用户不知道该应用程序有 WearOS 配套应用程序,因为它在手机 Play 商店应用程序或网站上不可见。 watch 也是如此——当用户从他们的 WearOS 设备中发现我的应用程序并安装它时,手机对应的应用程序没有安装,也没有通知用户。
WearOS 应用程序不是独立的,因此它需要手机应用程序才能运行。它具有相同的包名称并使用相同的 key 进行签名。 watch 和手机上的 WearOS 应用程序允许所有通知。
那么,有没有办法自动安装 WearOS 应用程序,或者至少让用户知道他们可以安装它?谢谢!

最佳答案

自 Wear OS 2.0 以来,无法完全自动化此操作。谷歌全力支持“独立”Wear 应用程序的想法,让我们的集成应用程序开发人员大多处于冷落状态。
据我所知,自 Wear 2.0 以来安装这两个应用程序的唯一方法是如下流程:

  • 当用户运行您的手机应用程序时,使用 Capability API 检查您的应用程序是否安装在配对 watch 上。
  • 如果未安装,请向用户显示适当的 UI,告诉他们问题所在。
  • 从该 UI 中,使用 RemoteIntent.startRemoteActivity() 为他们提供一个操作,将 watch 上的 Play 商店打开到您的应用列表中。 .

  • 你需要在你的 watch 应用程序中做类似的事情,以防用户首先安装并运行它。
    此过程记录在此处(带有一些代码示例):https://developer.android.com/training/wearables/apps/standalone-apps#detecting-your-app

    关于android - 如何自动安装 WearOS 配套应用程序和 Android 手机应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63950020/

    相关文章:

    android - 如何检查用户是否在 Google Play 中对我们的应用程序进行了评分?

    Android Wear DataMap 条目有效期多长时间

    android - 应用程序关闭时运行警报

    java - Android 在检索图像时给出空指针

    Android:如何禁止在扫描 NFC 标签时重新打开您的应用程序?

    android - 安全警报: Your app contains embedded private keys or keystore files

    android - 在 Google Play 上发布应用程序后更改名称是否可取?

    android - 在 Android Wear 上添加语音功能

    kotlin - Wear OS 磁贴和媒体服务

    java - 如何将 Mpesa Api 与 android 集成