Hi everyone again!
Right now, I'm trying to import contacts from SIM to my app. And my code is as follows:

function getContactsFromSIM() {
    var type = 'ADN'; // valid values: 'ADN', 'FDN'
    var request = navigator.mozContacts.getSimContacts(type);
    console.log('Importing SIM contacts (' + type + ')...');
    request.onsuccess = function onsuccess() {
console.log('Success reading SIM contacts. '+request.result.length);
        for (var i = 0; i < request.result.length; i++) {
            var contact = request.result[i];
console.log(contact.name <http://contact.name> + ' - ' + contact.tel <http://contact.tel>);
        }
        console.log(request.result.length + ' contacts found.');
    }; request.onerror = function onerror() {
        console.log('Error reading SIM contacts.');
    };
}

I'm testing in a full-otoro device, I have contacts in the SIM, and when I test my app the android-sdk console show me that:

E/GeckoConsole(664): Content JS LOG at http://192.168.0.35/fi/js/firefox.js:8 in getContactsFromSIM: getContactsFromSIM E/GeckoConsole(664): Content JS LOG at http://192.168.0.35/fi/js/firefox.js:11 in getContactsFromSIM: Importing SIM contacts (ADN)...
E/GeckoConsole(664): [JavaScript Error: "uncaught exception: 2147500033"]

I also have permissions for access and read-write contacts in the manifest.
I don't know if exists another way to make it without mozContacts.
What I'm doing wrong? Any idea?

Thanks in advance
Regards, Mar

_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps

Reply via email to