I am working on android apps. I want to add a contact in android phone group. The code I am using is below:
ContentValues values = new ContentValues();
values.put(ContactsContract.CommonDataKinds.GroupMembership.RAW_CONTACT_ID,personId);
values.put(
ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID,GROUP_ID);
values.put(
ContactsContract.CommonDataKinds.GroupMembership.MIMETYPE,ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE);
Log.d("values :", ""+ values);
this.getContentResolver().insert(
ContactsContract.Data.CONTENT_URI, values);
Unfortunately, this is not working. Does anyone see anything obviously wrong with the above code?
Bellow code is worked perfect in my side. So, Please try it or you can download sample example from chetanbhalala