Add # sign in tel uri using Url_launcher

邮差的信 提交于 2019-12-24 08:03:24

问题


In flutter app i am using Url_launcher dependency to open phone application with content to dial using following function Url_launcher.launch("tel:\*5*250#" ). It does open the application but # symbol is not dialed in there else everything works ok ... Any workaround to include # ???


回答1:


I found this issue only on Android devices. It works on iOS.

You need to use URL encoding for special character in a URL.

So # equals %23

This will work launch('tel:\*5*250\%23');

This answer helped me.




回答2:


The easiest and safest way is encode the mobile number typed by user and pass it through

Uri.encodeComponent(numberTypedByUser)

Like this.

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


来源:https://stackoverflow.com/questions/53737159/add-sign-in-tel-uri-using-url-launcher

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!