Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (android)
Viewing all articles
Browse latest Browse all 7655

Android incorrect contacts updating

$
0
0

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");
}

Viewing all articles
Browse latest Browse all 7655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>