Link Android application with contacts/phonebook programmatically
Asked Answered
E

1

7

I'm currently writing an App which allows to extend the standart Android contacts / phonebook. The user can add some informations / content associated with a specific contact. I want the standart phonebook to show an link to my application on every contact which has additional data in my application. For example WhatsApp is able to do so. If somebody from you phonebook has an WhatsApp account the phonebook displays a small WhatsApp icon next to the contact. If you hit the icon WhatsApp starts automatically a chat with this specific person.

My question is now how this can be achieved ? If someone can point me in the right direction it would be great.

I guess it must be done somehow with an ContentProvider. I already specified an ContentProvider but I don't know how to tell the Contacts app that this one exist or where I need to register this provider.

Ehf answered 7/1, 2015 at 9:20 Comment(0)
O
1

You need to use Contacts Provider. Class ContactsContract.Contacts provide access to all the contacts available in android mobile.

You need to have Read contacts permission in your app manifest.

<uses-permission android:name="android.permission.READ_CONTACTS" />

Refer following Android developer site. http://developer.android.com/training/contacts-provider/index.html

Source code can be downloaded at http://developer.android.com/shareables/training/ContactsList.zip

Ownership answered 7/1, 2015 at 9:30 Comment(3)
Thanks for your answer Jeno. I know that this allows my app to read the Contacts from the phone, but I want to associate my app with an specific entry in the Contacts app. If you open the Contacts app I want it to display the icon of my app next to the specific contact (like Whatsapp does). And I want to allow the user to directy open my app with this specific contact (like WhatsApp does). How can I achive this ?Ehf
It turned out that this was the right place look and that I was looking to ContactsContract.RawContacts and their aggregation. thanks JenoEhf
@Ehf have you find any solution?if so then let me knowEggleston

© 2022 - 2024 — McMap. All rights reserved.