[
https://issues.apache.org/jira/browse/CB-6429?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14642864#comment-14642864
]
Victor Adrian Sosa Herrera commented on CB-6429:
------------------------------------------------
I was trying this scenario but seems it got fixed in a release over this year.
If this still happens, please reopen or open a new one.
BTW; I'm using Cordova CLI 5.1.1 and cordova-plugin-contacts v1.1.0
> Stored numbers in a contacts array not be stored or displayed properly
> ----------------------------------------------------------------------
>
> Key: CB-6429
> URL: https://issues.apache.org/jira/browse/CB-6429
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android, Plugin Contacts
> Reporter: Anthony Scuderi
> Priority: Minor
>
> I was running this on Ubuntu 12.04. This code below was taken from the
> apache cordova website ==>
> http://cordova.apache.org/docs/en/2.5.0/cordova_contacts_contacts.md.html .
> I did modify the line one line to <script type="text/javascript"
> charset="utf-8" src="cordova.js"></script>
> Testing the contacts plugin on an android device. When I run this it should
> print out the phone numbers that are stored in the contacts array. Seems
> like that is not be stored properly. Not sure if this is a tools issue or
> more of a cordova problem.
> <!DOCTYPE html>
> <html>
> <head>
> <title>Contact Example</title>
> <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
> <script type="text/javascript" charset="utf-8">
> // Wait for Cordova to load
> //
> document.addEventListener("deviceready", onDeviceReady, false);
> // Cordova is ready
> //
> function onDeviceReady() {
> // create a new contact
> var contact = navigator.contacts.create();
> // store contact phone numbers in ContactField[]
> var phoneNumbers = [];
> phoneNumbers[0] = new ContactField('work', '212-555-1234', false);
> phoneNumbers[1] = new ContactField('mobile', '917-555-5432', true);
> // preferred number
> phoneNumbers[2] = new ContactField('home', '203-555-7890', false);
> contact.phoneNumbers = phoneNumbers;
> // save the contact
> contact.save();
> // search contacts, returning display name and phone numbers
> var options = new ContactFindOptions();
> options.filter="";
> filter = ["displayName","phoneNumbers"];
> navigator.contacts.find(filter, onSuccess, onError, options);
> }
> // onSuccess: Get a snapshot of the current contacts
> //
> function onSuccess(contacts) {
> for (var i=0; i<contacts.length; i++) {
> // display phone numbers
> for (var j=0; j<contacts[i].phoneNumbers.length; j++) {
> alert("Type: " + contacts[i].phoneNumbers[j].type + "\n" +
> "Value: " + contacts[i].phoneNumbers[j].value + "\n"
> +
> "Preferred: " + contacts[i].phoneNumbers[j].pref);
> }
> }
> };
> // onError: Failed to get the contacts
> //
> function onError(contactError) {
> alert('onError!');
> }
> </script>
> </head>
> <body>
> <h1>Example</h1>
> <p>Find Contacts</p>
> </body>
> </html>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]