Questions tagged [contactscontract]

Android's Contacts API is defined in the android.provider.ContactsContract and related classes.

The Android platform provides a Contacts API for managing and integrating contacts from multiple accounts and from other data sources.

To handle overlapping data from multiple sources, the contacts content provider aggregates similar contacts and presents them to users as a single entity.

ContactsContract defines an extensible database of contact-related information. Contact information is stored in a three-tier data model: Contacts, Raw Contacts and Data.

More information can be found in the documentation for the ContactsContract class.

551 questions
5
votes
0 answers

Android: Getting all the contacts of local address book

I have a problem displaying exactly those contacts in my app, which are in the address book of my phone. From the google contacts apps I found many different versions, how to query these contacts: Using no selection Uri uri =…
5
votes
1 answer

How to get contacts with which the user talks often?

Is it possible using ContactsContract to get contacts with which the user talks often? I know I can use the CallLog ContentProvider and try to figure that out, but I wanted to know if there is already a way to do it.
dors
  • 5,802
  • 8
  • 45
  • 71
5
votes
1 answer

Obtaining a SINGLE cursor with full name details and phone numbers

I want to create a single Cursor that contains both given name, family name and phone nr. These columns are not located together in any of the containers available under ContactsContract and the only way I've been able to get this information is by…
user1293081
  • 331
  • 1
  • 3
  • 12
4
votes
1 answer

Distinct CONTACT_ID from ContactsContract.Data

I need to make a query to ContactsContract.Data table and values in CONTACT_ID column would be different (distinct). Code: final Uri uri = ContactsContract.Data.CONTENT_URI; final String[] projection = new String[] {// …
QuickNick
  • 1,921
  • 2
  • 15
  • 30
4
votes
1 answer

Filter out Facebook Contacts from the Contact Picker

I have a contact picker in my application that keeps crashing when a facebook contact is selected. I won't have the code I'm using to open the picker in front of me, but I believe I'm accessing the contacts through a call similar to this: new…
wajiw
  • 12,239
  • 17
  • 54
  • 73
4
votes
2 answers

Query Android contact to get ACCOUNT_TYPE and ACCOUNT_NAME

I am able to obtain a list of contacts and their basic information like: name. phones, emails, ims, notes, organizations for backup purposes by using ContactsContract.Contacts.CONTENT_URI for a list of Contacts and other specific URIs for different…
Alin
  • 14,809
  • 40
  • 129
  • 218
4
votes
1 answer

How to update Android contact company?

I recently created a Sync adapter for my app, It will sync contacts I am getting via a web request with the contacts in the phone. I have no problem adding the contact, however I cannot get the contact information to correctly update when contact…
4
votes
1 answer

Android : Adding Notes to Existing Contacts

I'm trying to use the ContactsContract api to add some notes to my contacts. I'm not sure I fully understand the various contact IDs and Raw Contact IDs. My problem seems pretty similar to what is discussed here. I want to : 1. Find a specific…
advantej
  • 20,155
  • 4
  • 34
  • 39
4
votes
2 answers

Insert contacts Last Name using Intent android

Google should really document their contacts API, its really irritating to find out how to insert specific details. Anyways, I want to send following contact details to Contact native application of android: Name Last Name [Family Name] Street…
Shardul
  • 786
  • 3
  • 11
  • 20
4
votes
0 answers

How to create a ContactsContract.Directory provider and call it in Incoming/outgoing call?

I'm creating a ContactsContrat.Directory in my android app. That I want to do is: In incoming/outgoing call, the Android dialer do a query to my custom directory that I've registered. This is the resource that I've read to do it:…
S.P.
  • 2,274
  • 4
  • 26
  • 57
4
votes
0 answers

Update/insert in new Android contacts API

When adding a contact in the new android contacts API, can I use newAssertQuery() also for insert, or will it only update an existing entry. If so, what is the difference between newAssertQuery() and newUpdate()? More generally, do I need to check…
Roar Skullestad
  • 2,427
  • 3
  • 26
  • 35
4
votes
4 answers

Get Postal address from a contact using ContactsContract api on android

I am using ContactsContract api intent for showing all contacts from an activity. This intent returns an id of the contact. I need to get the postal address of this contact. Here is the code which i am using for showing contacts: Intent intent =…
mudit
  • 25,306
  • 32
  • 90
  • 132
4
votes
0 answers

Android Contacts.CONTENT_STREQUENT_URI throws SQLiteException on Android 4.1.2 and 4.4.2

I need some assistance with this. I am trying to query the strequent table (ContactsContract.CONTENT_STREQUENT_URI) on Android to get starred and most frequently contacted contacts. Cursor cursor =…
4
votes
1 answer

Updating/Setting own user profile image

I know how to retrieve a user profile from the ContentResolver. If I have a bitmap, how can I set it as a user profile picture (replace it OR set it, if none exists)? I load the user profile like following: Uri dataUri =…
prom85
  • 16,896
  • 17
  • 122
  • 242
4
votes
0 answers

Listen for changes to individual android contacts

I have a list of phone numbers and I need to be notified when changes occur to the contacts with those numbers in android contacts database. What I tried so far: 1st method: Register a…