我正在使用Phonegapp开发一个非常简单的webapp,我想在用户点击特定按钮时打开Play商店APP(Android)。我读了一些q%a但我不知道怎么做 我有一个像这样的index.html:
<!DOCTYPE html>
<html>
<head>
<title>Just a development test ->dany_danay</title>
<link href="jquery-mobile/jquery.mobile-1.0a3.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery-1.5.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile-1.0a3.min.js" type="text/javascript"></script>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
var watchID = null;
var pictureSource; // Origen de la imagen
var destinationType; // Formato del valor retornado
// Espera a que PhoneGap conecte con el dispositivo.
//
document.addEventListener("deviceready",onDeviceReady,false);
function alertDismissed() {
// do something
}
</script>
</head>
<body>
<div data-role="page" id="page">
<div data-role="header">
<h1>Your SmartPhone info</h1>
</div>
<center><a href="https://play.google.com/store/apps/details?id=com.tusmartphone.dany&feature=search_result#?t=W251bGwsMSwyLDEsImNvbS50dXNtYXJ0cGhvbmUuZGFueSJd" rel="external" /><img src="http://media.go2speed.org/brand/files/offermobi/1981/20130605194659-WARFAL_b01_320X50_04.png"/></a>
</center>
</body>
</html>
我尝试在中添加rel =“external”或rel =“system” 这个js函数:
<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://play.google.com/']").each(function() {
this.href = this.href.replace(/^http:\/\/play\.google\.com\//,
"market://");
});
}
}
});
</script>
我必须调用一个意图,但不知道我怎么能用html或js做到这一点...... 不知道如何证明这一点:https://stackoverflow.com/questions/15325864/phonegap-android-open-play-store或者:How to Open Google Play store from Phonegap http://tannerburson.com/blog/2012/05/28/IntentChooser-my-first-PhoneGap-Cordova-plugin/
答案 0 :(得分:4)
您想使用市场链接。
market://details?id=<package_name>
http://developer.android.com/distribute/googleplay/promote/linking.html