我应该以不同于处理深层链接的方式处理 firebase 动态链接吗?
Should I treat firebase dynamic links in a way that differs from treating deep links?
我正在尝试将 Firebase 动态 links 与 android 导航组件一起使用,问题是我试图指定一个片段以在 link 打开时自动打开但是打开的是指定图形的起始目的地,而不是所需的片段
我已经尝试将 link 改为 www.google.com 而不是实际的动态 link。出乎意料的是它奏效了!!
这里是 activity 的清单代码,它的导航图中有片段
<activity android:name=".vvm.authentication.view.AuthenticationActivity" >
<intent-filter android:label="New Password">
<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="example.page.link"/>
</intent-filter>
</activity>
这里是我想直接打开的fragment的导航图定义
<fragment
android:id="@+id/newPasswordFragment"
android:name="com.example.fatorty.vvm.authentication.view.NewPasswordFragment"
android:label="fragment_new_password"
tools:layout="@layout/fragment_new_password">
<deepLink
android:id="@+id/deepLink"
app:uri="https://example.page.link"
android:autoVerify="true"/>
</fragment>
当我将清单中的 android:host="example.page.link"
和片段定义中的 app:uri="https://example.page.link"
替换为 android:host="www.google.com"
和 app:uri="https://www.google.com"
时,应用程序的行为符合预期!
有什么建议吗?
注意:Firebase 的完整 link 是
终于找到解决办法了。
对于 Firebase 生成的动态 link,link 由两部分组成。
前缀:
系统用来指向google播放或自定义网站等后缀:
如果已安装,该应用会接收到。如果您使用的是旧版应用架构、Activity 和 intents,则 intent 过滤器会收到后缀并正常运行。
如果是导航组件和导航图,您必须将前缀 + 后缀放在深层 link uri 属性中,应用程序才能正确运行,如下所示:
<fragment
android:id="@+id/newPasswordFragment"
android:name="com.example.example.vvm.authentication.view.NewPasswordFragment"
android:label="fragment_new_password"
tools:layout="@layout/fragment_new_password">
<deepLink
android:id="@+id/deepLink"
app:uri="https://example.page.link/?link=https://example.page.link"
android:autoVerify="true"/>
</fragment>
我正在尝试将 Firebase 动态 links 与 android 导航组件一起使用,问题是我试图指定一个片段以在 link 打开时自动打开但是打开的是指定图形的起始目的地,而不是所需的片段
我已经尝试将 link 改为 www.google.com 而不是实际的动态 link。出乎意料的是它奏效了!!
这里是 activity 的清单代码,它的导航图中有片段
<activity android:name=".vvm.authentication.view.AuthenticationActivity" >
<intent-filter android:label="New Password">
<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="example.page.link"/>
</intent-filter>
</activity>
这里是我想直接打开的fragment的导航图定义
<fragment
android:id="@+id/newPasswordFragment"
android:name="com.example.fatorty.vvm.authentication.view.NewPasswordFragment"
android:label="fragment_new_password"
tools:layout="@layout/fragment_new_password">
<deepLink
android:id="@+id/deepLink"
app:uri="https://example.page.link"
android:autoVerify="true"/>
</fragment>
当我将清单中的 android:host="example.page.link"
和片段定义中的 app:uri="https://example.page.link"
替换为 android:host="www.google.com"
和 app:uri="https://www.google.com"
时,应用程序的行为符合预期!
有什么建议吗?
注意:Firebase 的完整 link 是
终于找到解决办法了。 对于 Firebase 生成的动态 link,link 由两部分组成。 前缀:
系统用来指向google播放或自定义网站等后缀:
如果已安装,该应用会接收到。如果您使用的是旧版应用架构、Activity 和 intents,则 intent 过滤器会收到后缀并正常运行。
如果是导航组件和导航图,您必须将前缀 + 后缀放在深层 link uri 属性中,应用程序才能正确运行,如下所示:
<fragment
android:id="@+id/newPasswordFragment"
android:name="com.example.example.vvm.authentication.view.NewPasswordFragment"
android:label="fragment_new_password"
tools:layout="@layout/fragment_new_password">
<deepLink
android:id="@+id/deepLink"
app:uri="https://example.page.link/?link=https://example.page.link"
android:autoVerify="true"/>
</fragment>