2016-01-11 23 views
1

我試圖建立我的第一個web應用程序使用英特爾XDK Android手機從一個鏈接來啓動一個安裝原生Android應用程序。在一個web應用程序

我已經能夠通過一個鏈接(電話:)和外部網頁通過鏈接(<a href="#" onclick="openInAppBrowserBlank('http://williamsislandclub.com?userId=1');"><img src="img/wi_app_button_essentials_blue.png"></a>)成功打開撥號器。

問題:沒有安裝在大多數我們的社區的手機(com.app.gateaccess)的原生Android應用。我想創建一個打開此應用程序的鏈接,但找不到可以理解的解決方案。

回答

0

你必須使用自定義方案的意圖過濾器添加到manifist文件,在你的應用程序中相應的活動標記。格式爲:<scheme>://<host>:<port>/<path>

例子:

<intent-filter> 
    <action android:name="android.intent.action.VIEW"/> 
    <category android:name="android.intent.category.BROWSABLE"/> 
    <category android:name="android.intent.category.DEFAULT"/> 
    <data android:scheme="<PUT SCHEME HERE>" android:host="<PUT URL HERE>" android:path="<PUT PATH HERE>"/> 
    </intent-filter> 

替換這個標籤中包含HTTP或HTTPS

URL方案替換您的網址這個標籤。 (即mycoolapps.com)

與URL即(/ sweetApp)後路徑替換此標記。

完整的例子:

讓說,如果你想打開的應用程序與以下網址:

http://mycoolapps.com/sweetApp

你的意圖過濾器看起來像下面這樣:

<intent-filter> 
     <action android:name="android.intent.action.VIEW"/> 
     <category android:name="android.intent.category.BROWSABLE"/> 
     <category android:name="android.intent.category.DEFAULT"/> 
     <data android:scheme="http" android:host="mycoolapps.com" android:path="/sweetApp"/> 
     </intent-filter> 
+0

對不起因爲我的經驗不足 - 我可以強加一點澄清嗎? (1)英特爾XDK不會創建如此名稱的清單文件;我會在哪裏插入意圖? (2)URL也會讓我失望 - 如果我的Android手機上安裝了本機應用程序,那麼我將使用什麼url方案,url和路徑?在Google Marketplace中,應用程序包名稱爲com.app.gateaccess – Arthur

+1

對不起,我不使用intel-xdk。我給出的解決方案通常適用於android本機應用程序這些行需要添加在原生android應用程序的顯式文件中。 – Adnan

相關問題