My application should be able to edit in the user's contacts, I have accomplished that smoothly on iOS and it is working fine, on Android most of the time when I update a certain contact it updates another one, rarely on other occasions it updates the right contact so what is the problem that is causing this and how to solve it ? here is the code:
function updateEmail(id,key,value) { var contact=Titanium.Contacts.getPersonByID(id); var email= contact.email; try { email[key].push(value); } catch(error) { email[key]=[value]; } contact.email=email; saveUpdate(contact); } function saveUpdate(contact) { if(OS_ANDROID) { Titanium.Contacts.save([contact]); } else if(OS_IOS) { Titanium.Contacts.save(); } alert("contact updated"); }