使用phonegap查找联系人的实现方法
导读:收集整理的这篇文章主要介绍了使用phonegap查找联系人的实现方法,觉得挺不错的,现在分享给大家,也给大家做个参考。 实例如下:<!DOCTYPE htML> <html> <head&...
收集整理的这篇文章主要介绍了使用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;
icontacts.length;
i++){
for(var j=0;
jcontacts[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>
以上这篇使用phonegap查找联系人的实现方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: 使用phonegap查找联系人的实现方法
本文地址: https://pptw.com/jishu/585697.html
