react-native-communications 电话、短信、邮件、浏览器
第一种方法:
Linking:调用系统的电话、短信、邮件、浏览器等功能
Linking.canOpenURL(this.props.url).then(supported => {
if (!supported) {
console.log('Can\'t handle url: ' + this.props.url);
} else {
return Linking.openURL(this.props.url);
}
}).catch(err => console.error('An error occurred', err));
调用系统的电话功能
tel:
Android:直接到转到系统拨号页面,没有问题
iOS:弹出一个alert,显示电话号码,一个取消按钮,一个确定按钮
点击确定拨打电话,没有问题
点击取消不打电话,程序崩溃提示错误(我看不懂),有问题,暂未解决
NO2.调用系统的短信功能
smsto:
Android:跳转发短信界面,没有问题
iOS:无法跳转到发短信界面,一直提示没有权限
然而打电话、发短信、Safari浏览器并不需要权限,有问题,暂未解决
NO3.调用系统的邮件功能
mailto:xxxxxxxxx@qq.com
Android:没有问题
iOS:没有问题
NO4.调用系统的浏览器功能
http://www.baidu.com
Android:没有问题
iOS:没有问题
第二种方法:
三方组件:react-native-communications
地址:https://github.com/anarchicknight/react-native-communications
网址里面的 README.md 写的非常的清楚,而且还有例子可供参考
npm install react-native-communications
import Communications from 'react-native-communications';
render() {
return (
<View style={styles.container}>
<TouchableOpacity style={{height:,marginTop:}}
onPress={()=>{
Communications.phonecall('', false);
}}>
<Text>调用系统打电话功能</Text>
</TouchableOpacity><TouchableOpacity style={{height:,marginTop:}}
onPress={()=>{
Communications.text('','要发送的内容');
Communications.textWithoutEncoding('','要发送的内容encoding');//这种方法需要将内容encoding
}}>
<Text>调用系统发短信功能</Text>
</TouchableOpacity><TouchableOpacity style={{height:,marginTop:}}
onPress={()=>{
Communications.email(['emailAddress1', 'emailAddress2'],null,null,'My Subject','My body text')
}}>
<Text>调用系统发邮件功能</Text>
</TouchableOpacity><TouchableOpacity style={{height:,marginTop:}}
onPress={()=>{
Communications.web('https://github.com/facebook/react-native')
}}>
<Text>调用系统打开网页功能</Text>
</TouchableOpacity>
</View>
);
}
react-native-communications 电话、短信、邮件、浏览器的更多相关文章
- 如何从应用直接跳转AppStore 电话 短信 邮件
//如何从应用直接跳转AppStore [[UIApplication sharedApplication]openURL:[NSURL URLWithString:@"应用程序的下载链接& ...
- Android下调用收发短信邮件等
Android下调用收发短信邮件等 1,调web浏览器Uri myBlogUri = Uri.parse("http://xxxxx.com");returnIt = new In ...
- python 短信邮件
短信邮件 hashlib- md5:非对称加密,不可逆的,经常用于加密密码然后存储- 示例: ```python import hashlib # 创建hash对象,可以指定需要加密的字符串 ...
- supersr--打电话/短信分享/邮件分享
// Created by apple on 15/6/17. // Copyright (c) 2015年 Super All rights reserved. // #import " ...
- Zabbix集成Cloud Alert(睿象云)实现电话短信预警
Zabbix 集成 睿象云智能告警平台 CA ( Cloud Alert ) 一 .简介与前期了解 Cloud Alert 通过应用,接入监控系统/平台的告警,集中管理您的告警,统一分派通知,统一分析 ...
- html5开发手机打电话发短信功能,html5的高级开发,html5开发大全,html手机电话短信功能具体解释
在非常多的手机站点上,有打电话和发短信的功能,对于这些功能是怎样实现的呢.事实上不难,今天我们就用html5来实现他们. 简单的让你大开眼界.HTML5 非常easy写,但创建网页时,您常常须要反复做 ...
- 短信外部浏览器H5链接一键跳转微信打开任意站
今天讲讲微信跳转的那些事情,这项技术最早出现在在线广告上面,可以从外部引流到微信并打开微信内置浏览器然后打开一个指定的网页地址,在这个网页里面可以放任何想推广的内容,可以是引导文案.活动内容,或者是一 ...
- iOS打电话,发短信,发邮件,打开网址
//调用自带mail [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://admin@hzl ...
- Python基础—14-邮件与短信
邮件与短信 邮件发送 简介: 邮件服务器.账户.密码 相关协议:SMTP.POP3.IMAP 默认TCP协议端口:25 用途:经常用在一个网站的注册激活.通知.找回密码等场景 库:smtplib 示例 ...
- Zabbix 安装及微信短信提醒
Zabbix简介 Zabbix 近几年得到了各大互联网公司的认可,当然第一点归功与它强大的监控功能,第二点免费开源也得到了广大用户的青睐.Zabbix 能将操作系统中的绝大部分指标进行监控,比如(CP ...
随机推荐
- 64_r3
rubygem-resque-cleaner-0.3.0-5.fc24.noarch.rpm 24-Sep-2016 22:26 22422 rubygem-resque-cleaner-doc-0. ...
- openjudge-NOI 2.6-2988 计算字符串距离
题目链接:http://noi.openjudge.cn/ch0206/2988/ 题解: 首先,题目有误,少了一个添加操作 和求解LCS之类的思路类似 f[i][j]表示a序列中1..i的部分和b序 ...
- Android 开发笔记(二)菜单设计
菜单设计一 // 创建菜单 public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, 0, 0, "关于"); men ...
- selenium grid应用1-多浏览器执行用例
driver =webdriver.Remote(command_executor=’http://127.0.0.1:4444/wd/hub’, desired_capabilities=Desir ...
- Mybatis Common Mapper文件
表名/条件/字段 都可以传入进去 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mappe ...
- Linux文档时间戳查看和修改——stat
查看文件时间戳命令:stat awk.txtFile: `awk.txt'Size: 20 Blocks: 8 IO Block: 4096 regular fileDevice: 801h/2 ...
- Delphi根据字符串实例化对象
我们可以通过ClassRegistry单元的TClassRegistry类很轻松的根据字符串创建出对象. 下面是该类几个主要函数的说明: // 获取TClassRegistry自身的单例引用class ...
- bzoj 1877 最小费用流
思路:挺裸的费用流,拆拆点就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se sec ...
- logstash通过redis收集日志
(1)部署redis 1丶安装redis yum install epel-release -y yum install redis -y 2丶修改配置文件 #vim /etc/redis.conf ...
- poj2253 Frogger(Floyd)
题目链接 http://poj.org/problem?id=2253 题意 给出青蛙A,B和若干石头的坐标,现在青蛙A要跳到青蛙B所在的石头上,求出所有路径中最远那一跳的最小值. 思路 Floyd算 ...