如何链接到 Android Market 应用程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3239478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to link to Android Market app
提问by hpique
What's the best way to link to an Android Market app without knowing who will get the link (Android user/non-Android user) and from where (desktop/mobile)?
在不知道谁将获得链接(Android 用户/非 Android 用户)以及从何处(桌面/移动设备)获取链接的情况下,链接到 Android Market 应用程序的最佳方式是什么?
For iPhoneI use the itunes.apple.com app links. They show a complete description of the app, and if you have iTunes installed, either on the desktop or on your mobile, it allows you to download the app directly. Example: http://itunes.apple.com/us/app/ibooks/id364709193?mt=8
对于iPhone,我使用 itunes.apple.com 应用程序链接。它们显示了该应用程序的完整描述,如果您在桌面或移动设备上安装了 iTunes,它允许您直接下载该应用程序。示例:http: //itunes.apple.com/us/app/ibooks/id364709193?mt=8
For AndroidI currently use a third-party Android Market web browser (see answer below), but I was wondering if there was a better alternative, and hoping to learn from others who have dealt with this issue.
对于Android,我目前使用第三方 Android Market 网络浏览器(请参阅下面的答案),但我想知道是否有更好的选择,并希望向处理过此问题的其他人学习。
采纳答案by Romain
I was looking into this yesterday, and what a coincidence: the new Android Market** was just released today!
我昨天正在研究这个,真是巧合:今天刚刚发布了新的 Android Market**!
Going to https://play.google.com/store/apps/details?id=com.google.earthfrom your desktop computer now shows a full page about the selected app, with screenshots, reviews etc. You can even install the app on your phone remotely!
Opening the same URL from a mobile phone will prompt you if you want to view the website or go straight to the Google play app.
从您的台式计算机转到https://play.google.com/store/apps/details?id=com.google.earth现在会显示有关所选应用的完整页面,包括屏幕截图、评论等。您甚至可以安装远程手机上的应用程序!
从手机打开相同的 URL 会提示您是要查看网站还是直接转到 Google Play 应用程序。
I'm guessing this will now be the preferred method to link to an app.
我猜这现在将成为链接到应用程序的首选方法。
** Currently called Google Play
** 目前称为 Google Play
回答by Felix
I think this will help you: http://d.android.com/guide/publishing/publishing.html#marketintent
我认为这会帮助你:http: //d.android.com/guide/publishing/publishing.html#marketintent
Currently, the Android Market does not have a web interface, or a desktop client. Basically, you have two types of URIs you can use:
目前,Android Market 没有 Web 界面或桌面客户端。基本上,您可以使用两种类型的 URI:
market://details?id=com.google.earth
http://market.android.com/details?id=com.google.earth
market://details?id=com.google.earth
http://market.android.com/details?id=com.google.earth
Both options will open up the Android Market if clicked from an Android device (that has the Market installed). Details about each one:
如果从 Android 设备(安装了 Market)上单击,这两个选项都将打开 Android Market。每一项的详细信息:
- This one is only understood by Android devices with the Market installed. The Market is opened immediately. This is best embedded into QR codes that can be read with any Android device with a camera. You can show these QR codes on your website or wherever. Check out http://qrcode.kaywa.com/for a nice QR code generator (you can even hotlink to them)
- This one is understood by any device (since it's
http://
), but opening it up in a browser gives a 404 Not Found error (because, as I said, there's no web interface for the Market, yet). However, it is possible that Google will, at some point, make a web interface for the Market and keep this link structure. If you click on such a link with an Android device, you will get a "Complete this action with..." dialog, giving you a choice between the Browser and Android Market.
- 只有安装了 Market 的 Android 设备才能理解这一点。市场立即开放。这最好嵌入到任何带摄像头的 Android 设备都可以读取的二维码中。您可以在您的网站或任何地方显示这些二维码。查看http://qrcode.kaywa.com/一个不错的二维码生成器(你甚至可以热链接到它们)
- 任何设备都可以理解这个(因为它是
http://
),但是在浏览器中打开它会出现 404 Not Found 错误(因为,正如我所说,市场还没有 Web 界面)。但是,Google 可能会在某个时候为 Market 制作一个 Web 界面并保留此链接结构。如果您使用 Android 设备单击此类链接,您将看到一个“使用...完成此操作”对话框,让您在浏览器和 Android Market 之间进行选择。
Quote from the link at the beginning (emphasis mine):
引用开头的链接(强调我的):
Note that these URIs work only when passed as Intent data — you can't currentlyload the URIs in a web browser, either on a desktop machine or on the device.
请注意,这些 URI 仅在作为 Intent 数据传递时才起作用——您当前无法在 Web 浏览器中加载 URI,无论是在台式机还是在设备上。
Make sure to give it a read, it's a good resource.
一定要读一读,这是一个很好的资源。
Edit:in the meantime (i.e. until Google makes an interface for the Android Market), it's perfectly fine to use services such as Crycket and I've seen a lot of people do it.
编辑:在此期间(即在 Google 为 Android Market 制作界面之前),使用 Crycket 之类的服务非常好,我已经看到很多人这样做了。
回答by Tyson
The new format for making sure urls to apps open in Google Play is for example market://details?id=com.adobe.reader
of course you'll need to look at the url in a browser to get the "com.?.?" part of the url.
例如,确保在 Google Play 中打开应用程序网址的新格式market://details?id=com.adobe.reader
当然是您需要在浏览器中查看网址才能获得“com.?.?” 网址的一部分。
回答by Alexey Vesnin
market://details?id=com.your.app.id instead of http://play.google.com/store/apps/details?id=com.your.app.idwill do the thing automatically.
market://details?id=com.your.app.id 而不是http://play.google.com/store/apps/details?id=com.your.app.id会自动做这件事。
回答by demosten
Here is what I'm using in my web pages. It is based on JavaScript and jQuery. The idea is to search for 'android' sub-string inside browser's UserAgent and if that is the case - replace HTTP URI part with Android Market URI part, inside all links:
这是我在我的网页中使用的内容。它基于 JavaScript 和 jQuery。这个想法是在浏览器的 UserAgent 中搜索“android”子字符串,如果是这种情况 - 在所有链接中用 Android Market URI 部分替换 HTTP URI 部分:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
updateAndroidMarketLinks();
// some more core here ...
function updateAndroidMarketLinks()
{
var ua = navigator.userAgent.toLowerCase();
if (0 <= ua.indexOf("android")) {
// we have android
$("a[href^='http://market.android.com/']").each(function() {
this.href = this.href.replace(/^http:\/\/market\.android\.com\//,
"market://");
});
}
}
});
</script>
</head>
<body>
<a href="http://market.android.com/details?id=com.google.earth" target="_blank">Download for Android</a>
</body>
</html>