我将实施此方案:
万维网。 example.com - >启动我的应用程序
http:// example.com - >启动我的应用程序
http:// www.example.com - >启动我的应用程序
https:// example.com - >启动我的应用程序
https:// www.example.com - >启动我的应用程序
但是...
http:// example.com/dont/start/app - >在默认浏览器中打开链接。
通过使用intent-filter,它会打开我的应用程序。
<activity
android:name=".MainActivity"
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:scheme="http" />
<data android:scheme="https" />
<data android:host="example.com" />
</intent-filter>
</activity>
答案 0 :(得分:1)
一种方法是在这种情况下直接打开浏览器。喜欢这个
onCreate() {
if(uri is in path we don't want) {
open browser directly via intent
finish();
return;
}
//Handle a URL we do want
}
要直接打开浏览器,您可以通过How to find default browser set on android device找出默认浏览器的内容并明确启动它。