查找 Android 应用程序的包名称以使用 Intent 从 Web 启动 Market 应用程序 [英] Find package name for Android apps to use Intent to launch Market app from web

查看:22
本文介绍了查找 Android 应用程序的包名称以使用 Intent 从 Web 启动 Market 应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个移动网站,其中包含一个页面,人们可以从该页面下载我们推荐的相关应用.我发现 instructions 用于创建链接以启动市场,但这假设您是相关应用程序的开发人员并且知道确切的包名称.

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?

此外,事实证明,这些说明对于创建 Web 超链接并不真正有效.它们只为您提供一个 URI,供您在另一个 Android 应用程序的 Java 代码字符串中引用.我们的站点在 Drupal 中,所以 Java 无法运行.

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.

对于 iPhone,我发现 简单说明我需要来自 iTunes 商店的 URL/链接样式,所以我正在寻找类似的信息.

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:

  • 如果您有 .apk 的副本,只需将其作为 zip 文件打开并查看 AndroidManifest.xml 文件即可.顶级 <manifest> 元素将具有 package 属性.
  • 如果您在设备上安装了该应用并且可以使用 adb 进行连接,则可以启动 adb shell 并执行 pm list packages -f,显示每个已安装 apk 的包名称.
  • 如果你只是想手动查找几个包名,你可以在 http 上搜索应用://www.cyrket.com/m/android/,包名显示在URL中
  • 您也可以使用 PackageManager
  • 从 Android 应用程序中执行此操作
  • 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

获得包名后,您只需链接到 market://search?q=pname:<package_name>http://market.android.com/search?q=pname:<package_name>.两者都将在 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).

这篇关于查找 Android 应用程序的包名称以使用 Intent 从 Web 启动 Market 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆