gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 12:36:42 26 4
gpt4 key购买 nike

我已使用 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 hasan associated watch app (either an embedded APK or an APK uploaded viathe Play Console), the user gets a watch notification about theavailable watch app. Tapping the notification opens the watch PlayStore, 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/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com