getting the Contact's Birthday of a HTC Sense phone
- by Pentium10
I am not sure, but probably HTC Sense does the following, syncs my Facebook contacts to my phone along with their mobile number and their birthday. This shows well in the agenda and the user panel. But as it turns out it doesn't use the standard SDK way to store the birthdays.
As if I use the following code to get the birthday of a contact it returns NO data for those contacts.
public String getBirthday() {
if (data.containsKey(BIRTHDAY)) {
return CRUtils.getString(data, BIRTHDAY);
} else {
// read birthday
Cursor c = ctx.getContentResolver()
.query(
Data.CONTENT_URI,
new String[] { Event.DATA },
Data.CONTACT_ID + "=" + this.getId() + " AND "
+ Data.MIMETYPE + "= '"
+ Event.CONTENT_ITEM_TYPE + "' AND "
+ Event.TYPE + "=" + Event.TYPE_BIRTHDAY,
null, null);
if (c != null) {
try {
if (c.moveToFirst()) {
String s = c.getString(0);
this.setBirthday(s);
return s;
}
} finally {
c.close();
}
}
return "";
}
}
How can I fix this?