I'm trying to add a birthday event to contacts but the event doesn't show up when displaying the contact in the People app. When going into 'Edit' mode of the contact, an event DOES show up, but no selected date (see attached screenshot) as if the format is wrong.
When inspecting the contacts2.db in an sqlite viewer, it seems that the date are formatted just fine, like other events/birthdays that are properly showing (see attached image. First row is a manually entered birthday through the app, and the second row, was added by my app and doesn't show)
Here is the code I am using, which follows the SampleSyncAdapter from the $ANDROID_HOME sdk
public ContactOperations addBirthday(Date date) {
mValues.clear();
if(date!=null) {
mValues.put(ContactsContract.CommonDataKinds.Event.TYPE, ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY);
mValues.put(ContactsContract.CommonDataKinds.Event.START_DATE, BIRTHDATE_FORMATTER.format(date));
mValues.put(ContactsContract.CommonDataKinds.Event.MIMETYPE, ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE);
addInsertOp();
}
return this;
}
private void addInsertOp() {
if (!mIsNewContact) {
mValues.put(ContactsContract.CommonDataKinds.Phone.RAW_CONTACT_ID, mRawContactId);
}
ContentProviderOperation.Builder builder =
newInsertCpo(ContactsContract.Data.CONTENT_URI, mIsSyncOperation, mIsYieldAllowed);
builder.withValues(mValues);
if (mIsNewContact) {
builder.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, mBackReference);
}
mIsYieldAllowed = false;
mBatchOperation.add(builder.build());
}