【发布时间】:2016-12-08 16:17:29
【问题描述】:
事情是这样的:
我必须实现与应用程序启动器活动端点的深度链接。
所以在清单中,在启动器活动标签中有:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</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="scheme" />
</intent-filter>
活动 onCreate 方法的片段:
if (getIntent() != null) {
// Url scheme
if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
// Process the deelink
} else {
// Do something else
}
}
问题:活动打开两次,一次有良好意图 (ACTION_VIEW),另一次没有
我尝试使用诸如 single_top、single_task、single_instance 之类的标签,但随后只启动了不良意图(默认启动器意图)。
我怎样才能使两个意图过滤器一次触发一个?
【问题讨论】:
-
你能发布你实际解析深度链接的活动代码吗?
-
这应该是无关紧要的,因为活动不能被创建两次......但我会过去部分代码表单 onCreate
-
你是对的,对不起。请看答案
标签: android android-intent deep-linking