'How to automate installation of play store apps by package name?
Is it possible to batch install regular play store apps by passing the package name to some activity in the adb shell or in some other way (with or without root)?
I am not looking for installing an APK file, but using the play store functionality to download and install an app silently (or with a confirmation) given its package such as com.android.chrome.
For example, when you click the 'Install' button for an app on the desktop version of https://play.google.com the app will be silently downloaded and installed to the selected device for the gmail account that you used in the desktop browser. I would imagine this is an intent triggered by Google Cloud Messaging platform (FCM/GCM). Is it possible to trigger the same functionality directly on the device by invoking the corresponding gapps activity with the package name?
Solution 1:[1]
This is only a semi-automated method, but it did save me a lot of time when I tried to have a fresh install of all the apps that I previously used on my new phone.
Here is how I did this:
Save the list of package names in a file, for example
/sdcard/pkgs.After entering the shell by typing
adb shell, define the following shell function using the following command:g() { am start -a android.intent.action.VIEW -d "market://details?id=$1" -p com.android.vending; }This shell function will open the Google Play info page for a given package. For example, to open the Google Play info page for Chrome, you can use the command
g com.android.chrome.Type the following command to interactively install all the apps in the file
/sdcard/pkgs:for p in `cat /sdcard/pkgs`; do echo $p; g $p; read; doneThis command will open the Google Play info page of all the packages in
/sdcard/pkgsone at a time, and will not proceed to the next app unless you press the enter key. At this point, all you have to do is to tap the install button on your phone and then press the enter key on your computer. As long you see the "pending" state you can proceed to the next app. You don't need to wait until the installation to finish.
Of course, step 3 could be automatized by emulating tap events, for example, using the input tap x y command. For me it is not worth the effort since I don't want to handle all the exception cases (e.g. in the case where an app is no longer available on Google Play, or a phone call jumps in, etc).
Solution 2:[2]
Use this abd command in the terminal to install: "adb install appname.apk" After successful installation you get a Success message.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | sincostan |
| Solution 2 | Girish B.R |
