I'm trying to write an application where a user can enter his name, phone number, Facebook ID/ Twitter ID etc...which will then be added to the existing contacts application.
Name, phone number - by default exists in the contacts app. How can I go about adding the Facebook ID or Twitter ID? I mean custom fields in the contacts application from my application.
You can easily do that by inserting you own mimetype:
Builder builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID,0)
.withValue(ContactsContract.Data.MIMETYPE,"vnd.android.cursor.item/facebook")
.withValue("data1","bkhashfehFacebookId")
And then you can read your own data from your own application easily using (query) method and you pass you mimetype in the search criteria.
Also if you want to update an already existed contact, you just need to add new mimtype to that contact.
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