android - 如何从 adb shell 命令启动 AFW 徽章应用程序?

标签 android shell android-package-managers android-for-work

enter image description here我无法从 Adb shell 命令启动 Android For work 启用的应用程序? 有人可以举个例子吗? 请参阅随附的屏幕,我想启动 Playstore 应用程序。 没有徽章的 ICON Play 商店应用程序也与带徽章的 Play 商店应用程序具有相同的 Activity 信息(com.android.vending/com.google.android.finsky.activities.MainActivity)。 而且我无法启动 Badge Play 商店 Activity 。请帮助我。

我尝试使用以下命令: adb shell am start com.android.vending/com.google.android.finsky.activities.MainActivity

它始终只启动非徽章 playstore 应用程序。

然后我按照 Google 的 AFW 博客进行了尝试: https://developer.android.com/work/managed-profiles.html

adb shell pm list users UserInfo{0:Drew:13} running UserInfo{10:Work profile:30} running

adb shell am start --user 10 -n "com.android.vending/com.google.android.finsky.activities.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

因此,我得到了 java.lang.SecurityException: Shell does not have permission to access user 10 错误。请有人帮助我。

最佳答案

我找到了启动应用程序的方法。 使应用程序处于 Debug模式并添加配置客户端的 clearUserRestriction,如下所示。

dpm.clearUserRestriction(adminName,UserManager.DISALLOW_DEBUGGING_FEATURES

如果我们有这些更改,那么我可以使用以下命令启动 Android For Work 徽章应用程序。其中 --user 10 是 AFW 预配用户。

adb shell am start --user 10 -n "com.android.vending/com.google.android.finsky.activities.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER

关于android - 如何从 adb shell 命令启动 AFW 徽章应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43722716/

相关文章:

java - Android 中快速变化的位图

Android:在 onDraw 上创建位图

java - 获取所有用户的应用列表

android - 如何以编程方式强制退出(或暂时禁用)Google App

android - 如何仅在 Android 上过滤已安装的游戏?

Android Intent 过滤器数据路径示例

android - 如何在 android 中获取 Retrofit 错误消息?

bash - 在 bash 中快速引用标准输出(即上一个命令的输出)?

arrays - for i in ${VAR} 如何在 bash 中工作,而不是 for i in "${VAR[@]}"?

linux - 在 shell 脚本中通过 fork() 父进程创建子进程