android - Flutter 深层链接在浏览器中不起作用

标签 android flutter dart deep-linking

我按照此处的建议对 Android list 进行了更改:
https://docs.flutter.dev/development/ui/navigation/deep-linking
因此,新的元数据和配置已添加到 MainActivity:

<!-- Deep linking -->
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" />
<intent-filter android:autoVerify="true">
    <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" android:host="flutterbooksample.com" />
    <data android:scheme="https" />
</intent-filter>
结果,当我按照他们所说的那样使用 adb 进行测试时:
adb shell am start -a android.intent.action.VIEW \
    -c android.intent.category.BROWSABLE \
    -d "http://flutterbooksample.com/book/1"
我得到了我想要的:
enter image description here
但是如果我尝试打开 url http://flutterbooksample.com/book/1直接在我的模拟器上的浏览器中,没有任何 react ,浏览器打开页面并且没有提示在我的应用程序中打开 url。
我需要做任何其他事情才能使其正常工作吗?

最佳答案

简答
您无法从 Web 浏览器的搜索栏中调用深层链接 URL。首先,您需要创建一个 HTML 页面。然后你可以点击链接。它会起作用的。
更多细节
就我而言,我创建了一个带有深层链接的 HTML 文件并将其发送到我的电子邮件。
HTML 文件

<a href="myapp://test">Open my app</a>
AndroidManifest.xml
<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="test"
        android:scheme="myapp" />
</intent-filter>

关于android - Flutter 深层链接在浏览器中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71015269/

相关文章:

dart - 如何在contenteditable div(Dart)中设置和获得插入符号位置?

android - 在手机(android/ios)上生成没有跟踪器的增强现实对象

java - 如何使用Android NFC API获取智能卡ATR?

Flutter:确保首先调用 FirebaseApp.initializeApp(Context)

flutter - 如何禁用 Flutter 中的按钮?

Flutter - 使用相同的提供者更新下拉列表并将数据发送到另一个小部件

android - 使用 ksoap2 将对象列表发送到 Web 服务 c#.Net

java - 崩溃 : com. badlogic.gdx.physics.box2d.World.jniCreateBody

flutter - 在下拉菜单中显示带有下拉选项的 Bottom Sheet 单击 flutter

flutter - 如何在 flutter 中从 firestore 数字格式中获取双倍