2013-07-15 148 views
1

我正在用Phonegapp開發一個非常簡單的webapp,當用戶單擊某個特定按鈕時,我想打開Play商店APP(Android)。我看了一些答疑一個,但我不知道我該怎麼辦呢 我有這樣一個index.html的:用PhoneGap打開Play商店

<!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 =「外部」或相對=「系統」 和這個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 Phonegaphttp://tannerburson.com/blog/2012/05/28/IntentChooser-my-first-PhoneGap-Cordova-plugin/

回答