这次给大家带来怎样使用phonegap查找联系人,使用phonegap查找联系人的注意事项有哪些,下面就是实战案例,一起来看一下。
实例如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Database Example</title>
<script type="text/javascript" charset="UTF-8" src="cordova.js"></script>
<script type="text/javascript" charset="UTF-8">
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
}
function onSuccess(contacts){
document.write(contacts.length+'contacts found.');
for(var i=0;i<contacts.length;i++){
for(var j=0;j<contacts[i].emails.length;j++){
document.write("Email="+contacts[i].emails[j].email);
}
}
alert('success');
}
function onError(error){
alert("Ooops!");
}
function findContact(){
var myOptions=new ContactFindOptions();
myOptions.filter="gmail";//过滤
var myFields=["emails"];//要查询的字段
navigator.contacts.find(myFields,onSuccess,onError,myOptions);
}
</script>
</head>
<body>
<button onclick="findContact();">Find Contact</button>
</body>
</html>相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
婚纱影楼小程序提供了一个连接用户与影楼的平台,相当于影楼在微信的官网。它能帮助影楼展示拍摄实力,记录访客数据,宣传优惠活动。使用频率高,方便传播,是影楼在微信端宣传营销的得力助手。功能特点:样片页是影楼展示优秀摄影样片提供给用户欣赏并且吸引客户的。套系页是影楼根据市场需求推出的不同套餐,用户可以按照自己的喜好预定套系。个人中心可以查看用户预约的拍摄计划,也可以获取到影楼的联系方式。









