I'm trying to modify the value of SEND_TO_VOICEMAIL from 0 to 1 and vice versa. I succeed to modify the others contact's details, such as name, number, nickname, email, ecc... but I need to change SEND_TO_VOICEMAIL.
I tried many possibility, but this should work... i guess:
String rawContactId = "1";
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ops.add(
ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
.withSelection( Data.RAW_CONTACT_ID + "=?" , new String[] { rawContactId })
.withValue(ContactsContract.RawContacts.SEND_TO_VOICEMAIL , 1)
.build()
);
try {
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
e.printStackTrace();
} catch (OperationApplicationException e) {
e.printStackTrace();
}
but the logcat says:
ERROR/AndroidRuntime(822): android.database.sqlite.SQLiteException: no such column: send_to_voicemail: , while compiling: UPDATE data SET send_to_voicemail=? WHERE _id =?
I really don't know what to try anymore. Any help would be really appreciated. Thanks.