I want to add a Custom field to the ContactsContract content provider. I'm trying to build a Voip application and would like to add a SIP address(name@domain) field to it. What MIME type will I need to associate with it? Also I want to add a group address field which will have a list of group addresses in it (name@domain, name@domain,...). Which MIME type will I have to associate with this type of field.
I also want to add custom fields to the Call History like a session ID and SIP address(name@domain) field. How can I customize the call history?
It'll be great if someone can give me an example.
You have to creat your own mime type for those.
Here is an example that saves a boolean as my custom mime type to the contacts. It uses the latest SDK 2.1
public void saveFormality() {
try {
ContentValues values = new ContentValues();
values.put(Data.DATA1, this.getFormality() ? "1" : "0");
int mod = ctx.getContentResolver().update(
Data.CONTENT_URI,
values,
Data.CONTACT_ID + "=" + this.getId() + " AND "
+ Data.MIMETYPE + "= '"
+ clsContacts.FORMALITY_MIMETYPE + "'", null);
if (mod == 0) {
values.put(Data.CONTACT_ID, this.getId());
values.put(Data.MIMETYPE, clsContacts.FORMALITY_MIMETYPE);
ctx.getContentResolver().insert(Data.CONTENT_URI, values);
}
} catch (Exception e) {
Log.v(TAG(), "saveFormality failed");
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With