Skip to content

Commit 43756af

Browse files
committed
Updated Readme
1 parent 39d238d commit 43756af

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

Android/ContactView/README.txt

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,27 @@ This plugin is a different philosophy to how contacts can work with PhoneGap And
33

44
How to use:
55

6-
Put the following javascript code in your initializer, after the DOM has loaded:
7-
8-
document.querySelector("#contact-name-to-native").addEventListener("touchstart", function() {
9-
window.plugins.contactView.show(document.getElementById("contact-name-from-native"), document.getElementById("phonenumber-contact"));
10-
}, false);
11-
12-
"#contact-name-to-native" is the element id that triggers the contact view.
13-
14-
"contact-name-from-native" is the element id in html that receives the contact's name. By convention, it is an input field's value that receives it. And "phonenumber-contact" is the phone number input field in the HTML. But you can edit this in ContactView.js to ignore phone or name.
6+
Usage:
7+
8+
window.plugins.contactView.show(success, failure);
9+
10+
Success returns an object with the name and the phone of the contact selected.
11+
12+
Example:
13+
14+
document.querySelector("#contact-name-to-native").addEventListener("touchstart", function() {
15+
window.plugins.contactView.show(
16+
function(contact) {
17+
document.getElementById("contact-name-from-native").value = contact.name;
18+
document.getElementById("contact-phone").value = contact.phone;
19+
},
20+
function(fail) {
21+
alert("We were unable to get the contact you selected.");
22+
}
23+
);
24+
}, false);
25+
26+
1527

1628
For the current files to work, you'll need to create a package (folders) called com.rearden. You can change this to whatever you like, just update the ContactView.js and ContactView.java.
1729

0 commit comments

Comments
 (0)