Phonegap / Cordova: "pickContact" returns nothing on Windows Phone

I'm working on a phone where a user can select a phone number or email from a mobile contact book. I'm using a contacts plugin to achieve this, which works on Android, but on Windows Phone 8, it displays me in a contact book, but after selecting any contact, it returns nothing (verified by posting a warning) without even throwing any errors. Basically I need to select a contact to send sms / email. I am using the following code:

$('.select-contact').bind('click', function () {
    navigator.contacts.pickContact(function(contact){
        alert(JSON.stringify(contact)); // not getting this alert on WP
        if (device.platform == 'Win32NT') {
            // need to write specific code for WP
        } else {
            sendSMS(contact.phoneNumbers[0].value); // checked this is not working on WP
        }
    },function(err){
        alert('Error: ' + err);
    });
});

      

http://plugins.cordova.io/#/package/org.apache.cordova.contacts

Is there a way to achieve this without creating a custom page. Any suggestion would be helpful.

Thanks in advance Jaya

+3


source to share





All Articles