<span style="font-size:10px;"><!DOCTYPE html>
<html>
<head>
<title>Contact 插件</title>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
//等待加載Phonegap
document.addEventListener("deviceready", onDeviceReady, false);
// Phonegap加載完畢
function onDeviceReady() {
var options = new ContactFindOptions();
options.filter="";
filter = ["displayName","organizations"];
navigator.service.contacts.find(filter, onSuccess, onError, options);
}
/ /onSuccess: 返回當前聯繫人結果集的快照
function onSuccess(contacts) {
for (var i=0; i<contacts.length; i++) {
for (var j=0; j<contacts[i].organizations.length; j++) {
alert("Pref: " + contacts[i].organizations[j].pref + "\n" +
"Type: " + contacts[i].organizations[j].type + "\n" +
"Name: " + contacts[i].organizations[j].name + "\n" +
"Department: " + contacts[i].organizations[j].department + "\n" +
"Title: " + contacts[i].organizations[j].title);
}
}
}
//onError:獲取聯繫人失敗
function onError() {
}
</script>
</head>
<body>
</body>
</html></span>
KeyMob是目前國內領先的移動廣告平臺,致力於爲手機應用APP開發者創造最好的手機廣告收入,爲數以萬計的APP廣告主提供精準的移動營銷和品牌推廣服務。
javascript