How to add app connections to an existing contact like WhatsApp and Viber does?

A

AC Question

I want my android app's connection to be added in an existing contact. I am sending my all contacts of Phonebook to server(with Name,Phone Number, and Contact ID) to check which contacts are registered for my app. I will send back to client app the contact IDs which are matched.

Now I want to add connection to those contacts in my Phonebook based on those returned IDs.

How can I add app connection by editing the contact based on one of returned contact ID?

Thanks