Find package name for Android apps to use Intent to launch Market app from web(查找 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 apackage
attribute. - If you have the app installed on a device and can connect using
adb
, you can launchadb shell
and executepm 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 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:查找 Android 应用程序的包名称以使用 Intent 从 Web 启动 Market 应用程序
基础教程推荐
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01