簡體   English   中英

如何從網頁打開Android應用程序?

[英]How to open android application from a webpage?

我可以從HTML調用我的應用程序嗎?

例如:我可以在我的應用中使用此代碼正確調用網頁。

android代碼:

  startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
                                    "myDomain.com")));

在我的網站中執行某項操作后,我想再次打開我的android應用。

我找到了這段代碼,

<a href="market://details?id=info.androidhive.slidingmenu">

但是只需致電Market即可找到並安裝該應用!

您可能會看一下: https : //developer.android.com/training/app-indexing/deep-linking.html

<activity
android:name="com.example.android.GizmosActivity"
android:label="@string/title_gizmos" >
<intent-filter android:label="@string/filter_title_viewgizmos">
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <!-- Accepts URIs that begin with "http://www.example.com/gizmos” -->
    <data android:scheme="http"
          android:host="www.example.com"
          android:pathPrefix="/gizmos" />
    <!-- note that the leading "/" is required for pathPrefix-->
    <!-- Accepts URIs that begin with "example://gizmos”
    <data android:scheme="example"
          android:host="gizmos" />
    -->
</intent-filter>

因此,您的應用將通過以下鏈接啟動:

<a href="example://gizmos">

對於iOS,您可以設置URLSchemes,如果在瀏覽器上鍵入該URLSchemes即可啟動該應用程序:例如,如果您的應用程序稱為market

market://將啟動該應用程序

要添加URLScheme,請在信息標簽中執行以下操作: 在此處輸入圖片說明

您可以通過實現application:willFinishLaunchingWithOptions:application:didFinishLaunchingWithOptions:方法來處理url選項。

不再可能啟動Android Chrome 25 鏈接

對於iOS,您可以閱讀此問題

您可以通過在網站上添加一個小腳本並進行一些代碼更改來實現。 您必須制定網址計划。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM