Is it possible to add custom field to some contacts, with custom mimetype (like facebook profile) without writing sync adapter, authenticator and sync service? I do not want to add "synchronization" functionality for my application.
2 Answers
After long research I think that I found an answer to this question.
There is no way of creating custom clickable and visible fields without writing some Synchronization service code, authenticator and syncAdapter.
Here is sample code which is adding new account to "Accounts and synchronization", and adding new contact with custom field, which can be viewed in some activity from current project: https://github.com/nemezis/SampleContacts.

- 536
- 1
- 6
- 21
-
Can anyone please let me know how to read contact details from above link example in ViewingActivity. like name, phone number, email, custom field – Suresh Oct 04 '18 at 04:23
Android does support syncing custom fields 'out of the box' if you use Gmail.
You can use Gmail in the browser to add custom fields to any contact. This field will then sync to the phone.
However, to view or edit these on the phone, you will need to use some new applications.
I wrote an article that describes this process. Gmail's Contacts Custom Fields and Android.

- 1,986
- 28
- 33
-
curly: could you provide an example of the code how to get the custom field from the RawContacts, as I believe it should be somewhere there, right? I tried to take a look on Data[1-10] but I failed to find anything like that. Would be very valuable if you could give a short snippet from where you can fetch custom fields. Thanks! – mtfk Oct 08 '19 at 08:10
-
I don't have the code to hand, but I believe you just need to retrieve all the records of [Custom Type](https://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.BaseTypes.html#TYPE_CUSTOM). The data fields should contain the recognisable labels and data. – SoftWyer Oct 09 '19 at 07:24