如何自动安装 WearOS 配套应用程序和 Android 手机应用程序 [英] How to install WearOS companion app along with the Android phone app automatically

查看:71
本文介绍了如何自动安装 WearOS 配套应用程序和 Android 手机应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用 Google Play 控制台将我的 Android 和 WearOS 应用作为单独的 APK 发布 多 APK 交付方式.

从相应设备浏览时可以发现这两个应用程序 - 手机上的 Android 应用程序和手表上的 WearOS 应用程序.此外,当手机应用程序安装在 Android 设备上时,我可以在我的 WearOS 设备上看到我可以在手机上的应用程序"上安装配套应用程序.Play 商店应用中的屏幕.

Google 的官方 WearOS 文档 声明如下:p><块引用>

在运行 Wear 2.0 的设备上,当用户安装具有关联的手表应用(嵌入式 APK 或通过Play 管理中心),用户会收到有关可用的手表应用程序.点击通知会打开手表播放商店,让用户可以选择安装手表应用.

但是,在手机上安装 Android 应用后,什么也没有发生.此外,用户不知道该应用程序具有 WearOS 配套应用程序,因为它在手机 Play 商店应用程序或网站上不可见.手表也是如此——当用户从他们的 WearOS 设备上发现我的应用程序并安装它时,手机对应的应用程序没有安装,也没有通知用户.

WearOS 应用程序不是独立的,因此它需要手机应用程序才能运行.它具有相同的包名称并使用相同的密钥进行签名.手表和手机上的 WearOS 应用程序都允许所有通知.

那么,有没有办法自动安装 WearOS 应用程序,或者至少让用户知道他们可以安装它?谢谢!

解决方案

自从 Wear OS 2.0 以来,没有办法完全自动化这个.谷歌全力以赴地提出独立"的想法.Wear 应用程序,让我们这些集成应用程序的开发人员大部分都被冷落了.

据我所知,自 Wear 2.0 以来安装这两个应用程序的唯一方法是如下流程:

  1. 当用户运行您的手机应用时,使用 Capability API 检查您的应用是否安装在配对的手表上.
  2. 如果未安装,请向用户显示适当的 UI,告诉他们问题所在.
  3. 然后在该 UI 中,使用 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:

  1. When the user runs your phone app, use the Capability API to check if your app is installed on a paired watch.
  2. If it's not installed, show an appropriate UI to the user telling them about the problem.
  3. And from that UI, give them an action to open the Play Store on the watch to your app's listing, using 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

这篇关于如何自动安装 WearOS 配套应用程序和 Android 手机应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆