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.
It depends where exactly you want to get the information from. You have a bunch of options:
<manifest>
element will have a package
attribute. adb
, you can launch adb shell
and execute pm list packages -f
, which shows the package name for each installed apk. 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:<package_name>
. 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).
Use aapt
from the SDK like
aapt dump badging yourpkg.apk
This will print the package name together with other info.
the tools is located in
<sdk_home>/build-tools/android-<api_level>
or
<sdk_home>/platform-tools
or
<sdk_home>/platforms/android-<api_level>/tools
Updated according to geniusburger 's comment. Thanks!
The following bash script can be used to display the package and activity names in an apk, and launch the application by passing it an APK file.
apk_start.sh
package=`aapt dump badging $* | grep package | awk '{print $2}' | sed s/name=//g | sed s/\'//g`
activity=`aapt dump badging $* | grep Activity | awk '{print $2}' | sed s/name=//g | sed s/\'//g`
echo
echo package : $package
echo activity: $activity
echo
echo Launching application on device....
echo
adb shell am start -n $package/$activity
Then to launch the application in the emulator, simply supply the APK filename like so:
apk_start.sh /tmp/MyApp.apk
Of course if you just want the package and activity name of the apk to be displayed, delete the last line of the script.
You can stop an application in the same way by using this script:
apk_stop.sh
package=`aapt dump badging $* | grep package | awk '{print $2}' | sed s/name=//g | sed s/\'//g`
adb shell am force-stop $package
like so:
apk_stop.sh /tmp/MyApp.apk
Important Note : aapt can be found here:
<android_sdk_home>/build-tools/android-<ver>/aapt
以下代码将列出它们:
adb shell dumpsys package <packagename>
Not sure if you still need this, but in http://www.appbrain.com/ , you look up the app and the package name is in the url. For example: http://www.appbrain.com/app/fruit-ninja/ com.halfbrick.fruitninja is the link for fruit ninja. Notice the bold
添加以上答案:要在任何Android设备上查找已安装应用程序的软件包名称: 转至Storage / Android / data / <package-name>
You can search the app online in the Google Play Store. When found, check the url, for example, https://play.google.com/store/apps/details?id=lutey.FTPServer&hl=en
The id parameter corresponds to the package name of the application. In the case of the url in the example, the package name is lutey.FTPServer.
Here are easy way to get app's full package. we can use astro file manager app. You can get it on android market. Astro app manager show us app's full package.
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
Once you have the package name, as described Chris Smith's answer , you could/should use an intent url for the link. It's a special format URL that will launch the package if the user has already installed it, or open the play store at the application's page if not...
intent://#Intent;package=qualified.package.name;end
The app needs to support this, with an activity tagged as browsable, but many will.
If you want this information in your phone, then best is to use an app like 'APKit' that shows the full package name of each app in you phone. This information can then be used in your phone.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.