当我的网站 url 点击或打开时启动我的 webview 应用程序
Launching my webview app when my website url cliks or open
我有一个网站和基于它的 WebView 应用程序。我的网站 link 就像 http://website.in/. when the user tries to open this link and associated links like http://website.in/post_name/,我希望 android 向他显示一个选择器对话框,他可以在其中选择选项以在他安装应用程序时使用我的应用程序打开 link。请给我 android 工作室的代码。
您需要将此 URL 深层链接到应用的 HomeActivity 或 MainActivity 中。在您的清单 main-activity 的声明部分添加下面输入的属性。
<activity
android:name="com.example.android.MainActivity"
android:label="@string/app_name" >
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="website.in"
android:pathPattern="/.*"
android:scheme="http" />
</intent-filter>
<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="website.in"
android:scheme="http" />
</intent-filter>
</activity>
我有一个网站和基于它的 WebView 应用程序。我的网站 link 就像 http://website.in/. when the user tries to open this link and associated links like http://website.in/post_name/,我希望 android 向他显示一个选择器对话框,他可以在其中选择选项以在他安装应用程序时使用我的应用程序打开 link。请给我 android 工作室的代码。
您需要将此 URL 深层链接到应用的 HomeActivity 或 MainActivity 中。在您的清单 main-activity 的声明部分添加下面输入的属性。
<activity
android:name="com.example.android.MainActivity"
android:label="@string/app_name" >
<intent-filter android:label="@string/app_name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="website.in"
android:pathPattern="/.*"
android:scheme="http" />
</intent-filter>
<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="website.in"
android:scheme="http" />
</intent-filter>
</activity>