查找Android应用程序的包名,以便使用意图从web启动市场应用程序

时间:2021-11-16 15:22:40

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.

而且,这些说明实际上并不适用于创建web超链接。他们只给你一个URI来引用另一个Android应用程序的Java代码串。我们的站点在Drupal中,所以Java不能工作。

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.

对于iPhone,我找到了从iTunes商店获取URL/链接样式的简单说明,所以我正在寻找这样的信息。

12 个解决方案

#1


93  

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.
  • 如果你有一个。apk的副本,它只是一个将它作为zip文件打开并查看AndroidManifest的例子。xml文件。顶层 元素将具有包属性。
  • 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.
  • 如果在设备上安装了应用程序并可以使用adb进行连接,则可以启动adb shell并执行pm列表包-f,它显示每个已安装的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
  • 如果您只是想手动查找几个包名,您可以在http://www.cyrket.com/m/android/上搜索这个应用程序,并且在URL中显示包的名称。
  • You can also do it progmatically from an Android app using the PackageManager
  • 你也可以通过使用PackageManager的Android应用程序来实现它

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).

获得包名后,只需链接到market://搜索?q = pname:< package_name >或http://market.android.com/search?q=pname:< package_name >。两者都将在Android设备上打开市场;后者显然也具有在其他硬件上工作的潜力(目前还没有)。

#2


55  

Use aapt from the SDK like

像使用SDK一样使用aapt

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

工具位于 /build-tools/android- /platform tools或 /platform /android- /tools

Updated according to geniusburger's comment. Thanks!

根据geniusburger的说法进行了更新。谢谢!

#3


7  

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.

可以使用下面的bash脚本在apk中显示包和活动名称,并通过传递apk文件来启动应用程序。

apk_start.sh

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文件名如下:

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.

当然,如果您只想显示apk的包和活动名称,请删除脚本的最后一行。

You can stop an application in the same way by using this script:

您可以使用以下脚本以相同的方式停止应用程序:

apk_stop.sh

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:

重要提示:此处有一个apt:

<android_sdk_home>/build-tools/android-<ver>/aapt

#4


4  

The following code will list them out:

以下代码将列出它们:

adb shell dumpsys package <packagename>

#5


3  

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

不确定是否还需要这个,但是在http://www.appbrain.com/中,您可以查找应用程序,包名在url中。例如:http://www.appbrain.com/app/fruit ninja/com.halfbrick.fruitninja是水果忍者的链接。注意到大胆

#6


2  

Adding to the above answers: To find the package name of installed apps on any android device: Go to Storage/Android/data/< package-name >

添加到上面的答案:在任何android设备上找到已安装应用程序的包名:去存储/ android /data/< package-name >。

#7


1  

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.

这里有一个简单的方法来获得应用程序的完整包。我们可以使用astro file manager app,你可以在android market上买到。Astro应用管理器向我们展示了应用的完整包。

#8


1  

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

你可以在谷歌游戏商店里搜索这个应用。找到后,检查url,例如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.

id参数对应于应用程序的包名。对于示例中的url,包名是lutey.FTPServer。

#9


0  

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.

这是一个相当困难的情况,您可以从apk文件中获取包名,但是我假设您希望自动执行它。

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.

AndroLib有很多应用程序的包名,但你必须解析它,因为没有我能找到的API。有一个开发部分可能有一些工具可以帮助您。

Good Luck

祝你好运

#10


0  

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...

一旦您有了包名(如Chris Smith的回答所述),您就可以/应该为链接使用一个意图url。它是一个特殊的格式URL,如果用户已经安装了它,它将启动这个包,或者在应用程序的页面打开play store,如果不是…

intent://#Intent;package=qualified.package.name;end

The app needs to support this, with an activity tagged as browsable, but many will.

这款应用需要支持这一功能,它的活动被标记为可浏览,但很多人会这样做。

#11


0  

  1. Go to setting app.
  2. 去设置应用程序。
  3. Click Storage & USB.
  4. 点击存储& USB。
  5. Click Phone Card.
  6. 单击电话卡。
  7. Click Android.
  8. 点击安卓。
  9. Click Data.
  10. 点击数据。

Now you can find the package names of all the apps that are installed in your phone.

现在你可以找到你手机里安装的所有应用的包名。

查找Android应用程序的包名,以便使用意图从web启动市场应用程序

#12


-2  

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.

如果你想在手机中获取这些信息,最好使用“APKit”这样的应用程序,它会显示你手机中每个应用程序的完整包名。这些信息可以在你的手机中使用。

#1


93  

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.
  • 如果你有一个。apk的副本,它只是一个将它作为zip文件打开并查看AndroidManifest的例子。xml文件。顶层 元素将具有包属性。
  • 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.
  • 如果在设备上安装了应用程序并可以使用adb进行连接,则可以启动adb shell并执行pm列表包-f,它显示每个已安装的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
  • 如果您只是想手动查找几个包名,您可以在http://www.cyrket.com/m/android/上搜索这个应用程序,并且在URL中显示包的名称。
  • You can also do it progmatically from an Android app using the PackageManager
  • 你也可以通过使用PackageManager的Android应用程序来实现它

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).

获得包名后,只需链接到market://搜索?q = pname:< package_name >或http://market.android.com/search?q=pname:< package_name >。两者都将在Android设备上打开市场;后者显然也具有在其他硬件上工作的潜力(目前还没有)。

#2


55  

Use aapt from the SDK like

像使用SDK一样使用aapt

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

工具位于 /build-tools/android- /platform tools或 /platform /android- /tools

Updated according to geniusburger's comment. Thanks!

根据geniusburger的说法进行了更新。谢谢!

#3


7  

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.

可以使用下面的bash脚本在apk中显示包和活动名称,并通过传递apk文件来启动应用程序。

apk_start.sh

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文件名如下:

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.

当然,如果您只想显示apk的包和活动名称,请删除脚本的最后一行。

You can stop an application in the same way by using this script:

您可以使用以下脚本以相同的方式停止应用程序:

apk_stop.sh

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:

重要提示:此处有一个apt:

<android_sdk_home>/build-tools/android-<ver>/aapt

#4


4  

The following code will list them out:

以下代码将列出它们:

adb shell dumpsys package <packagename>

#5


3  

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

不确定是否还需要这个,但是在http://www.appbrain.com/中,您可以查找应用程序,包名在url中。例如:http://www.appbrain.com/app/fruit ninja/com.halfbrick.fruitninja是水果忍者的链接。注意到大胆

#6


2  

Adding to the above answers: To find the package name of installed apps on any android device: Go to Storage/Android/data/< package-name >

添加到上面的答案:在任何android设备上找到已安装应用程序的包名:去存储/ android /data/< package-name >。

#7


1  

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.

这里有一个简单的方法来获得应用程序的完整包。我们可以使用astro file manager app,你可以在android market上买到。Astro应用管理器向我们展示了应用的完整包。

#8


1  

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

你可以在谷歌游戏商店里搜索这个应用。找到后,检查url,例如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.

id参数对应于应用程序的包名。对于示例中的url,包名是lutey.FTPServer。

#9


0  

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.

这是一个相当困难的情况,您可以从apk文件中获取包名,但是我假设您希望自动执行它。

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.

AndroLib有很多应用程序的包名,但你必须解析它,因为没有我能找到的API。有一个开发部分可能有一些工具可以帮助您。

Good Luck

祝你好运

#10


0  

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...

一旦您有了包名(如Chris Smith的回答所述),您就可以/应该为链接使用一个意图url。它是一个特殊的格式URL,如果用户已经安装了它,它将启动这个包,或者在应用程序的页面打开play store,如果不是…

intent://#Intent;package=qualified.package.name;end

The app needs to support this, with an activity tagged as browsable, but many will.

这款应用需要支持这一功能,它的活动被标记为可浏览,但很多人会这样做。

#11


0  

  1. Go to setting app.
  2. 去设置应用程序。
  3. Click Storage & USB.
  4. 点击存储& USB。
  5. Click Phone Card.
  6. 单击电话卡。
  7. Click Android.
  8. 点击安卓。
  9. Click Data.
  10. 点击数据。

Now you can find the package names of all the apps that are installed in your phone.

现在你可以找到你手机里安装的所有应用的包名。

查找Android应用程序的包名,以便使用意图从web启动市场应用程序

#12


-2  

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.

如果你想在手机中获取这些信息,最好使用“APKit”这样的应用程序,它会显示你手机中每个应用程序的完整包名。这些信息可以在你的手机中使用。