matiash:
ContentResolver.applyBatch() ContentProviderResult, . RawContact, uri RawContact ( ://com.android.contacts/raw_contacts/[raw_contact_id]).
If you are interested in raw_contact_id, then enough:
final ContentProviderResult[] results = contentResolver.applyBatch(ContactsContract.AUTHORITY, ops);
long rawContactId = ContentUris.parseId(results[0].uri);
But raw_contact_id on some devices may be different from contact_id. To get contact_id, you need to follow these steps:
final ContentProviderResult[] results = contentResolver.applyBatch(ContactsContract.AUTHORITY, ops);
final String[] projection = new String[] { ContactsContract.RawContacts.CONTACT_ID };
final Cursor cursor = contentResolver.query(results[0].uri, projection, null, null, null);
cursor.moveToNext();
long contactId = cursor.getLong(0);
cursor.close();
source
share