views:

1269

answers:

2

I'm creating a mobile website that will include a page from which people can download relevant apps that we recommend. I've found instructions for creating the links to launch the Market but this assumes that you are the developer of the app in question and know the exact package name.

Is there any way to get the package name, other than just contacting the developers and asking?

Also, it turns out that those instructions don't really work for creating web hyperlinks. They only give you a URI to reference in a string of Java code in another Android app. Our site is in Drupal, so Java is not going to work.

For the iPhone, I found easy instructions for getting the URL/link style I need from the iTunes store, so I'm looking for info like that.

A: 

This is quite a difficult situation, you can get the package name from the apk file, but i assume you want to do it automatically.

AndroLib has the package names for lots of apps but you would have to parse it as there is no API that i could find. Theres a dev section that may have some tools to help you.

Good Luck

Con
Thanks. This problem is actually harder than I thought, because the instructions that I linked to above have their own flaw--they're for linking to the Market from an app, not from a website. They require Java, which I don't think is going to play well with Drupal, to say the least.
eom
+3  A: 

It depends where exactly you want to get the information from. You have a bunch of options:

  • If you have a copy of the .apk, it's just a case of opening it as a zip file and looking at the AndroidManifest.xml file. The top level <manifest> element will have a package attribute.
  • If you have the app installed on a device and can connect using adb, you can launch adb shell and execute pm list packages -f, which shows the package name for each installed apk.
  • If you just want to manually find a couple of package names, you can search for the app on http://www.cyrket.com/m/android/, and the package name is shown in the URL
  • You can also do it progmatically from an Android app using the PackageManager

Once you've got the package name, you simply link to market://search?q=pname:<package_name> or http://market.android.com/search?q=pname:&lt;package_name&gt;. Both will open the market on an Android device; the latter obviously has the potential to work on other hardware as well (it doesn't at the minute).

Chris Smith