我按照此处的建议对 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"
我得到了我想要的:但是如果我尝试打开 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/