Home » Android » How to add custom app tag in native android contact app?

How to add custom app tag in native android contact app?

Posted by: admin May 14, 2020 Leave a comment

Questions:

I am developing an app and the requirement is to show the app icon in native contact app of android for the contacts who are also using my app i.e. they have installed and registered on my app. I want to show WhatsApp kind label in contacts.

Please see these two images for reference

enter image description here

enter image description here

I am fetching all the contacts and sending them to server which returns with the list of contacts who are using my app. Only for those contacts I have to show my app icon in contact app.

I read lot of resources but till now didn’t hit it.
I have created Account and added it to Settings (As it is the first step).
Then I created SyncAdapter and trying to sync contacts but not able to sync it.

I am stuck on this for the past 3 days.

I also noticed that however my app account is added in Settings->Accounts
but it is not added in Contact app (Contact->Account) and when I try to add my app account there. It doesn’t adds.

How to&Answers:

I solved the issue. Issue was in defining mimetype for the contact.

I was defining mimetype as

vnd.android.cursor.item/vnd.com.xxx.xxx.xx

However there shouldn’t be vnd in second part of mimetype.

Correct mimetype – vnd.android.cursor.item/com.xxx.xxx.xx