cfjedimaster / Cordova-Examples

A collection of Cordova/Ionic/etc demos.
982 stars 1.07k forks source link

Steal Contacts Demo not working #34

Closed vofili closed 6 years ago

vofili commented 6 years ago

Hi @cfjedimaster

I tried running the steal contacts demo with the cordova contacts plugin.

here's an snippet of my deviceReady


 onDeviceReady: function() {
        this.receivedEvent('deviceready');
        console.log("Device ready event ");

        //get contacts on user's device
        navigator.contacts.find(
        [navigator.contacts.fieldType.displayName],
        gotContacts,
        errorHandler);

      function gotContacts(c) {
        console.log("gotContacts, number of results "+c.length);

        for(var i=0, len=c.length; i<len; i++) {
            console.dir(c[i]);
        }
      }
        function errorHandler(e) {
        console.log("error " + e);

      }

    }

And the result i get when i run on an actual device:


 Failed to get birthday for contact from cursor
                                                                                  java.lang.IllegalArgumentException
                                                                                      at java.sql.Date.valueOf(Date.java:219)
                                                                                      at org.apache.cordova.contacts.ContactAccessorSdk5.getBirthday(ContactAccessorSdk5.java:1977)
                                                                                      at org.apache.cordova.contacts.ContactAccessorSdk5.populateContactArray(ContactAccessorSdk5.java:466)
                                                                                      at org.apache.cordova.contacts.ContactAccessorSdk5.search(ContactAccessorSdk5.java:295)
                                                                                      at org.apache.cordova.contacts.ContactManager$3.run(ContactManager.java:209)
                                                                                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
                                                                                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
                                                                                      at java.lang.Thread.run(Thread.java:818)

Please help with this as the stealcontacts demo isn't working

cfjedimaster commented 6 years ago

This looks to be a bug with the plugin itself - not my code. I'd file a bug report with them.

cfjedimaster commented 6 years ago

Closing for now.

vofili commented 6 years ago

Okay thanks for clarifying this.

So, what version of the plugin can I add to my cordova project would work?

cfjedimaster commented 6 years ago

You are using the right plugin, but it has a bug. So you need to report a bug on their repo so they can fix it.

vofili commented 6 years ago

okay thanks