I'm looking for a possibility to retrieve both, the package names and the common names of apps installed on an Android device via ADB – or at least to retrieve the common name if the package name is known. A quick search on our site brought up two related questions, but they don't solve my issue:
- How do I get the common name of an app having the package name (like com.android.blabla)? (command line or included app) doesn't work via ADB (but uses an app you've got to lookup with manually), matching the request of the OP
- How to find app based on package name? just reverts to an URL lookup at Google Play, which doesn't always fit (as not all apps are available there).
I'm looking for a way to retrieve the information directly from the device, if possible – not "any" way (including "web lookups" or "via an app") as those two questions have it.
I know there are multiple tools available to obtain package details:
adb dumpsys package: While this lists all packages with a bunch of details, the "common name" is not shown
adb shell pm list: only gives the package names
aaptwould be able to obtain the common name, but would require to first pull the
.apkfile from the device, which is not really convenient (and obviously will be pretty slow with many and/or large apps installed)
Did I miss something? I know the information must be on the device (how else could it show the app names in the GUI? I doubt Android parses the
.apk file each time the GUI need the "common name"). So is there a way to get hold of it, using ADB directly?
Background (if somebody's curious): I want to be able to quickly obtain a list of user-apps from any of my devices, without having to revert to acrobatics. A list of their package names I can retrieve using
adb shell pm list -3, but as those are package names only, recognizing apps is a guess-work. So if there were some ADB command to retrieve the common name for a given package name, I could simply use a loop like
for pkg in $(adb shell pm list -3); do echo "- $(adb <whatever_the_command_is> $pkg) ($pkg)"; done – and get a listing of all the installed user-apps in a "human readable format" together with their package names.
- See what "superflous" apps are installed (which I could remove)
- Cross-check lists from multiple devices
- Documentation ;)
- and probably more (but the above 3 are what I need it for)