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
3
votes
2 answers

Get all contacts and their details (e.g. postal address) in one OUTER JOIN query

I know how to retrieve contact data for specific contacts. However, i can't find a way to get all contacts plus some of their details in a single query. The following code gets all contacts having a postal address: Uri uri =…
compostus
  • 1,178
  • 10
  • 13
3
votes
3 answers

Getting Contact Phone Number

I am having trouble getting a contact phone number, i keep getting an error in the log cat saying 02-24 19:40:42.772: ERROR/CursorWindow(21467): Bad request for field slot 0,-1. numRows = 1, numColumns = 24 here is my code import…
tyczj
  • 71,600
  • 54
  • 194
  • 296
3
votes
2 answers

get all mobile number accociated with one contact android

I have contact added to my addressbook which has mutiple number like below. I want to fetch all 3 number of "User" using ContactsContract content uri. By using below code i got only one contact. Cursor cursorAddressBook = mContentResolver.query( …
Bhoomi Zalavadiya
  • 689
  • 12
  • 26
3
votes
2 answers

How to query Android 2.x Contacts with Emails and/or Phone Numbers?

Let's brute force your garden-variety Android 2.x Visible Contact ID/Names cursor (via ContactsContract): Cursor c = getContentResolver().query( Contacts.CONTENT_URI, new String[] { Contacts._ID, Contacts.DISPLAY_NAME }, …
Joe D'Andrea
  • 5,141
  • 6
  • 49
  • 67
3
votes
2 answers

How to uniquely identify a contact on ContactsContract.Contacts table

I have an app that gets the ContactsContract.Contacts.LOOKUP_KEY of a contact on the device and saves it on the app Db. After reading this page I thought I could use the LOOKUP_KEY to uniquely identify a contact, even when a contact is edited (for…
MDP
  • 4,177
  • 21
  • 63
  • 119
3
votes
1 answer

Detect if an android contact has been deleted

I am trying to maintain a contact database and get a callback for Add/Update/Delete as soon as something changes in the URI. I have written a ContentObserver to observe on ContactsContract.Contacts.CONTENT_URI on contacts. I get a callback as soon…
3
votes
1 answer

How can I get the "provider" (skype/whatsapp/google) of the contact/phone-number

How can I get the "phone number's contact provider" (google/skype/whatsapp/...) when I query android's contact provider? Currently I have these fields in my projection, and I'm not able to find the field that has the "contact-provider" information…
Gavriel
  • 18,880
  • 12
  • 68
  • 105
3
votes
0 answers

Android PhoneLookup.CONTENT_FILTER_URI throws IllegalArgumentException: column 'data1' does not exist

After a considerable amount of research I'm throwing this to see if it catches something. Im trying to query the Android's phone_lookup table to try and get some extra data from a phone number (lookup_key, photo_thumb_uri, etc...). Here's my…
3
votes
2 answers

Getting email and phone from contacts Android

I'm attempting to retrieve both email and phone via a single cursor described below. I'm using the Email.CONTENT_URI, hence I don't retrieve the phone number, so my phoneColumn is returning email. I tried using Phone.CONTENT_URI but it only returns…
ono
  • 2,984
  • 9
  • 43
  • 85
3
votes
1 answer

Get address details from a Contact in android

I am trying to access the contact details of a person which i selected from contact picker intent. here is what my contact looks like: Here is the code which i am using to open the contact picker: Intent pickContactIntent = new…
mudit
  • 25,306
  • 32
  • 90
  • 132
3
votes
1 answer

Get Raw Contact thumbnail photo

I'm trying to retrieve the raw contact's photo. I can successfully get the high resolution photo for a given raw contact but when I want to get the thumbnail photo for the same raw contact I get this exception: 02-17 05:43:44.695:…
dazito
  • 7,740
  • 15
  • 75
  • 117
3
votes
1 answer

can not remove contacts, android phonegap

I am working on android application in phonegap-3.1.0 I want to use phone contacts in my application, So I have refer this Document. Successfully installed the plugins for contacts When I remove saved contact(save from javascript code), It alerts…
Rohit
  • 687
  • 5
  • 22
3
votes
2 answers

How to query all the details of the Contact at once

EDIT:A list of what I consider important contact details: 1.NAME 2.PHONE NUMBER 3.EMAIL ADDRESS 4.WEBSITE 5.PHYSICAL ADDRESS I would prefer to do this using a pre-fetched contactId...using only one cursor to get all of the data…
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
3
votes
2 answers

Getting RawContact id using Contact id

I have built the following method to obtain the id from the RawContacts table using the id obtained from the Contacts table.This method fails thrwoing an Exception. public int getRawContactId(int contactId) { String[] projection=new…
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
3
votes
1 answer

Fetch contact list along with their primary email and phone number in a single query from the ContactProvider

I am trying to get the list of contacts with their phone and email details to display them in a list. What i have done now is do three separate queries. Get list of contacts to contactCursor from Contacts.CONTENT_URI Get all phone numbers to…
arjoan
  • 1,849
  • 2
  • 20
  • 39