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

How to modify an existing contact's phone number on Android

$
0
0

I've been able to modify and existing contact's phone number within my app on iOS, I am trying to do the same for Android but it doesn't seem to be working at all, even tried to modify other fields rather than the phone number but also in vain so how can I update a phone number on Android ? here is my code:

function updateNumber(id,value)
{
    var contact=Titanium.Contacts.getPersonByID(id);
    var phoneNumbers= contact.phone.mobile;
    phoneNumbers.push(value);
    var phone={mobile:phoneNumbers};
    contact.setPhone(phone);
    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