react native Linking 调用电话、短信、邮箱功能

版权声明:原创文章,未经允许不得转载!!! https://blog.csdn.net/halo1416/article/details/82661611

使用方式为: Linking.openURL(string)

1. 打开浏览器:Linking.openURL(url);

        eg:

Linking.openURL('https://itunes.apple.com/cn/app/%E4%B8%AD%E7%9F%B3%E5%8C%96%E8%B4%B5%E5%B7%9E%E5%A4%A7%E5%AE%A2%E6%88%B7/id1271694940?mt=8')

2. 打开电话功能:Linking.openURL("tel:" + 电话号码 );

        eg:Linking.openURL("tel:"+'10056' );

3. 打开短信功能:Linking.openURL("sms:" + 电话号码);

        eg:Linking.openURL("sms:"+'10056' );

        注意:Linking.openURL("smsto:" + 电话号码);  ==>> 在android上可以打开短信,但是ios不行,需要用 "sms:" !

4. 打开邮箱功能:Linking.openURL("mailto:" + 邮件地址);

        eg:Linking.openURL("sms:"+'[email protected]' );

ios上打开其他功能(跳转app):https://blog.csdn.net/imanapple/article/details/50161297  (比较全面,感谢!!)

文章仅为本人学习过程的一个记录,仅供参考,如有问题,欢迎指出

猜你喜欢

转载自blog.csdn.net/halo1416/article/details/82661611
今日推荐