How to use `adb` to install development apps for o

2019-01-26 03:30发布

Android 4.2 on tablets added support for multiple users per device (similar to desktop OSes), each of which can install and remove apps independently. Currently, using adb install /path/to/app.apk installs the app globally; every user can see and launch it (as if every user installed the same app from the Play store for example).

Is there a way to adb install an app onto a device so that only one user can see it in the launcher menu?

标签: java android adb
3条回答
甜甜的少女心
2楼-- · 2019-01-26 03:51
pm enable [--user USER_ID] PACKAGE_OR_COMPONENT
pm disable [--user USER_ID] PACKAGE_OR_COMPONENT

pm enable --user 12 org.mozilla.firefox_beta

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-01-26 03:55

It may not have a per-user 'adb install', but it does have a per-user 'start' option when you want actual run the APK for testing. By default the documentation says 'start' will just start for the currently running user, but you can do

adb shell am start --user USER activity...

to start the APK as someone else. To get a list of users, run

adb shell pm list users
查看更多
孤傲高冷的网名
4楼-- · 2019-01-26 04:01

Here is the full documentation of the adb tool: http://developer.android.com/tools/help/adb.html adb install doesn't provide any way to specify the target users.

查看更多
登录 后发表回答