flutter - 如何将特定链接重定向到您的应用,类似于 whatsapp
问题描述
如何创建您的应用程序的链接?像WhatsApp。如果您单击此链接https://wa.me/546497546464 ,该链接会将您带到手机中的 WhatsApp 应用程序。喜欢如何创建一个链接,将用户带到应用程序中的特定屏幕? - -在颤抖中- -
解决方案
这就是所谓的深度链接
以下来自https://flutter.dev/docs/development/ui/navigation/deep-linking
在 Android 上启用深度链接
将元数据标签和意图过滤器添加到具有“.MainActivity”名称AndroidManifest.xml
的标签内:<activity>
<!-- 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>
在 iOS 上启用深度链接
Info.plist
在 ios/Runner 目录中添加两个新密钥:
<key>FlutterDeepLinkingEnabled</key>
<true/>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>flutterbooksample.com</string>
<key>CFBundleURLSchemes</key>
<array>
<string>customscheme</string>
</array>
</dict>
</array>
推荐阅读
- css - 如何使用 Scss 避免 Css 中的重复代码?
- r - 如何在 R Studio 中调用 Neo4j 数据库 api
- python - Python:当已经有一个事件循环正在运行时,从同步方法调用异步代码
- laravel-8 - 如何在 laravel 中去除喷射流和强化?
- perl - 模块未安装在本地路径的 cpan 中
- flutter - Flutter 滑块半圆曲线形状
- scala - 如何在 Scala 3 中声明并将参数传递给隐式参数?
- python - “utf-8”编解码器无法解码位置 107 中的字节 0x92:无效的起始字节
- haskell - 如何编写一个计算一个单词的字母数量并将其打印为一对元音的函数?
- c# - 在 docker 镜像中找不到 CMake 没有 CSharp 编译器