爲了實現這個<intent-filter>
與<data>
元素。
例如,處理所有鏈接yourdomain.com,你會在你的AndroidManifest.xml把這個你<activity>
內:
<intent-filter>
<data android:scheme="http" android:host="yourdomain.com"/>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
或
<intent-filter>
<data android:scheme="my.special.scheme" />
<action android:name="android.intent.action.VIEW" />
</intent-filter>
的HTML頁面給予
現在錨標記如
<a href="my.special.scheme">
實際上,magic存在於清單文件中 您需要將活動聲明爲可瀏覽。
示例代碼。
<activity
android:name=".SplashActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="mywebsite.com"
android:path="/somepath/openNativeApp"
android:scheme="nativescheme" />
</intent-filter>
</activity>
而且你的錨標籤看起來像
<a href="nativescheme://mywebsite.com/somepath/openNativeApp">
嗨Hardik特里維迪,你可以共享任何示例應用程序的源代碼。它會幫助我很多。 – 2014-09-03 09:05:32
編輯答案。提供了我的應用程序中的示例代碼。 – 2014-09-03 09:18:01
嗨哈迪克Trivedi,它解決了感謝您的幫助。我可以從Web應用程序調用安卓應用程序。我需要更多的幫助。如果andriod應用程序在手機中不可用。它顯示錯誤消息「Page Not Found .......」,但我們不會向客戶顯示該消息。我們有引導客戶連接谷歌應用程序商店如果Andriod應用程序不可用在移動。請分享一下有沒有辦法。 – 2014-09-03 10:31:50