我使用具有 web_view 活动的应用程序链接助手工具添加了许多不同的URL。默认情况下,Android在我的 web_view 活动中添加了一些逻辑来处理意图,但这还不完整。支持的链接随应用程序打开,但不会加载。
这是清单文件的意图过滤器代码。如何在我的 web_view 活动中处理此意图?
<activity android:name="com.shop.web_view">
<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="https"
android:host="flipkart.com" />
</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:scheme="https"
android:host="amazon.in" />
</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:scheme="https"
android:host="snapdeal.com" />
</intent-filter>
</activity>
这是自动生成的Java代码
// ATTENTION: This was auto-generated to handle app links.
Intent appLinkIntent = getIntent();
String appLinkAction = appLinkIntent.getAction();
Uri appLinkData = appLinkIntent.getData();