So basically i have a function which deletes the contact from the phone:
String[] args = new String[]{number};
try {
ArrayList ops = new ArrayList();
// if id is raw contact id
ops.add(ContentProviderOperation.newDelete(ContactsContract.RawContacts.CONTENT_URI).withSelection(ContactsContract.RawContacts._ID + "=?", args).build());
// if id is contact id
// ops.add(ContentProviderOperation.newDelete(ContactsContract.RawContacts.CONTENT_URI).withSelection(ContactsContract.RawContacts.CONTACT_ID + "=?", args).build());
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
Toast.makeText(this, "Contact Deleted", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
Log.e("$$$$", "ERRORDELETE#133");
}
I tried both options, if raw contact or if contact id, both doesn't work/
When i run the APP and the function activates the 'Contact Deleted' Shows and in the log:
05-24 15:40:16.444 6540-6540/com.assistme.meirovichomer.assistme E/ViewRootImpl: sendUserActionEvent() mView == null
05-24 15:40:16.464 6540-6679/com.assistme.meirovichomer.assistme V/RenderScript: Application requested CPU execution
05-24 15:40:16.474 6540-6679/com.assistme.meirovichomer.assistme V/RenderScript: 0xa14a7e00 Launching thread(s), CPUs 4
I am not sure if i just don't understand the log or i missed anything but when i enter the contact list on the phone the contact is still no it, therefore wasn't deleted. Would love to get some help, Thank you very much in advance!