添加 # 使用 Url_launcher 登录 tel uri

Posted

技术标签:

【中文标题】添加 # 使用 Url_launcher 登录 tel uri【英文标题】:Add # sign in tel uri using Url_launcher 【发布时间】:2019-05-13 05:05:19 【问题描述】:

在颤振应用程序中,我使用 Url_launcher 依赖项打开电话应用程序,其中包含使用以下功能拨打的内容 Url_launcher.launch("tel:\*5*250#" )。 它确实打开了应用程序,但没有拨入 # 符号,否则一切正常......任何解决方法都包括 # ???

【问题讨论】:

***.com/a/43889379/217408 【参考方案1】:

我仅在 android 设备上发现了此问题。它适用于 ios

您需要使用URL encoding for special character in a URL。

所以# 等于 %23

这将工作launch('tel:\*5*250\%23');

This answer 帮助了我。

【讨论】:

【参考方案2】:

最简单最安全的方法是对用户输入的手机号码进行编码并通过

Uri.encodeComponent(numberTypedByUser)

像这样。

launch("tel:" + Uri.encodeComponent('*5*250#'));

【讨论】:

以上是关于添加 # 使用 Url_launcher 登录 tel uri的主要内容,如果未能解决你的问题,请参考以下文章

Flutter如何跳转外部地图app导航

firebase auth 和 url_launcher 版本冲突

Url_Launcher 在 iOS 上打开任何地图应用程序

Flutter/Firebase/url_launcher/ 如何从应用程序发送短信?

Flutter url_launcher 无法启动 webview 短谷歌表单链接

如何用颤振的 URL_launcher 包发送短信?