because not everything is documented for saving a contact (mostly only
finding contacts is documented)
This is what I have so far; it saves a contact on my phone, but gives
an error (errorcode 0).
The url is not saved, the rest seems to work.
What am I doing wrong? What can be done better? and can somebody help
me with adding a picture to the contact?
Thanks!
var contact = navigator.contacts.create();
contact.displayName = "Companyname";
contact.nickname = "Companyname";
var phoneNumbers = [2];
phoneNumbers[0] = new ContactField('work', 'phonenumber1', false);
phoneNumbers[1] = new ContactField('mobile', 'phonenumber2', true);
contact.phoneNumbers = phoneNumbers;
var emails = [3];
emails[0] = new ContactField('work', email1', true);
emails[1] = new ContactField('home', 'email2', false);
emails[2] = new ContactField('home', 'email3', false);
contact.emails = emails;
var addresses = [1];
var address = new ContactAddress();
address.type = 'work';
address.streetAddress='Streetname';
address.locality='City';
address.postalCode = 'postalcode';
address.country='country';
addresses[0] = address;
contact.addresses = addresses;
var organizations = [1];
var organization = new ContactOrganization();
organization.type = 'work';
organization.name='Companyname';
organizations[0] = organization;
contact.organizations = organizations;
var urls = [1];
urls[0] = new ContactField('work', 'http://mywebsite.nl',false);
contact.urls = urls;
// save
contact.save(onSaveSuccess,onSaveError);
--
You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
For more info on PhoneGap or to download the code go to www.phonegap.com