forked from phonegap/phonegap-start
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
43 lines (38 loc) · 1.21 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
<title>Contact Example</title>
<!-- weinre -->
<script src="http://HeikoBehrens-MBP.local:8080/target/target-script-min.js#anonymous"></script>
<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
// http://docs.phonegap.com/phonegap_contacts_contacts.md.html#Contact_ios_quirks
function doSearch() {
console.log("findme?");
var options = new ContactFindOptions();
options.filter="Hei";
options.multiple = true;
var fields = ["displayName", "name"];
navigator.contacts.find(fields, onSuccess, onError, options);
}
function onSuccess(contacts) {
console.log("success!");
console.log(contacts);
document.body.innerHTML += "<ul>";
for (var i=0; i<contacts.length; i++) {
console.log(contacts[i]);
var name = contacts[i].displayName;
document.body.innerHTML += "<li>"+name+"</li>"
console.log("Name = " + name);
}
document.body.innerHTML += "</ul>";
}
function onError(contactError) {
alert('onError!');
}
</script>
</head>
<body>
<h1 onclick="doSearch()">Contacts</h1>
</body>
</html>