1

I'm trying to:

  1. Get the package names of all apps on my device (none of them are mine so sadly I can't get it from the Manifest) and put it into a file to save for a class project.

  2. I also want to get the package names of only a select number of apps that I choose that I have on my phone. I was hoping there is a way to do that so that I don't have to manually look and copy over from all the different phones I have

Is it possible to get the package name of an Android app by its name using ADB when testing my app on my phone? Maybe by using aapt?

E.g. "ColorDraw" will return com.package.name.drawcolors.

Matthew Read
  • 50,567
  • 30
  • 145
  • 273
Vel
  • 21
  • 2
  • 5
  • This is for an installed app? Do you know the path to the APK, or only the "friendly name"? – Matthew Read Mar 08 '16 at 02:42
  • Hmm I guess I could find the path of the APK. When I install an APK on the Phone it goes to some directory right :/ if I did know the location of the APK using some command lines is it possible to get the Package Name of the app? Say I only know its name.... or maybe I could just find the package name based on the LAST installed app :) – Vel Mar 08 '16 at 02:46
  • 1
  • Sadly no, I've seen that post but they don't seem to answer what I want. I want to be able to 1.) Either get the last installed apps package name oe 2.) get the package name of the app based on it's name like "DrawColor" or something simple like youtube – Vel Mar 08 '16 at 03:00
  • I incorporated your comment since it gives the background of the issue. For the first part, if you want only to list the package without its displayed name, you can use adb shell pm list packages. For the second part, I somewhat believe the link I mentioned before could help, but something need to be added (sadly, I'm not good at writing shell script) – Andrew T. Mar 08 '16 at 04:10
  • Thank you, yea for the first I could use: ($adb shell pm list packages) but now I need to get the Apps name from the package name? An for the second I'm trying to get a package FROM an apps name haha. sorry it's a bit confusing here – Vel Mar 08 '16 at 05:28
  • 2
    @Vel that's exactly what the linked question (mine) was about. It's not possible to obtain the app name without additional installations (aapt) either on-device or on-PC. As Andrew suggested, your can use adb shell "pm list packages" to get the package list, strip the package: prefix from each line, then retrieve the corresponding page from Google Play and parse for its <TITLE> ;) Take a look at the code of my little tool Adebar, which does something like that to generate a device documentation. – Izzy Mar 08 '16 at 06:42
  • Thank you for commenting Izzy, I actually wanted to get a hold of you. Please correct me, looking at your link I do want the COMMON NAME and the ICON. 1.) GET COMMON NAME ---> After making an ADB connection I run this command [$for pkg in $(adb shell pm list -3); do echo "- $(adb <whatever_the_command_is> $pkg) ($pkg)"; done] ..... But I don't fully understand since I thought you said you didn't get it to work? an what are the commands? Could you clarify 2.) GET ICON ---> No idea hot to get Icon from package name .... I read your Adebar too :) [MY DEVICE IS ROOTED] – Vel Mar 08 '16 at 19:32

0 Answers0