【问题标题】:How to launch AFW badge apps from adb shell command?如何从 adb shell 命令启动 AFW 徽章应用程序?
【发布时间】:2017-05-01 16:35:42
【问题描述】:

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

我已尝试使用以下命令: 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} 正在运行 UserInfo{10:Work profile:30} 正在运行

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 错误。请有人帮助我。

【问题讨论】:

  • 您的工作资料是否受密码保护?你之前有试过打电话给adb root吗?

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


【解决方案1】:

我找到了启动应用程序的方法。 使应用程序处于调试模式并添加配置客户端的 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-01
    • 2011-02-06
    • 1970-01-01
    • 2018-07-25
    • 1970-01-01
    相关资源
    最近更新 更多