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

How to get details from a user-picked contact in Android without READ_CONTACTS-permission?

According to the Android documentation it is possible to read the details from a specifically user-selected contact without the READ_CONTACTS permission. This should be possible by using the contacts URI, resulting from the…
CM787
  • 73
  • 1
  • 5
2
votes
2 answers

Android: insert new raw contact

I would like to insert a new raw contact. I'm sure this involve some sort of getContentProvider().insert using a ContactsContract uri of some sort. Can anyone show an example using a ContentValues to to insert a brand new contact? (Update) There is…
Noah Seidman
  • 4,359
  • 5
  • 26
  • 28
2
votes
0 answers

ContactsContract and ContentResolver - WHEN is cursor null?

I use a cursor like following to retrieve contacts from the phone: String[] selection = new String[] { ContactsContract.Data.RAW_CONTACT_ID, ContactsContract.Data.CONTACT_ID, …
prom85
  • 16,896
  • 17
  • 122
  • 242
2
votes
0 answers

Cursor - Make sure the Cursor is initialized correctly before accessing data from it

I rarely get following error: Couldn't read row 439, col 60 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.os.Parcel.readException(Parcel.java:1433) at…
prom85
  • 16,896
  • 17
  • 122
  • 242
2
votes
1 answer

Fetching a contact with lookupkey gives unexpected contat-id

So I have a problem.. Im receiving a list of contacts by doing: mContentResolver.query(Contacts.CONTENT_URI, CONTACTS_PROJECTION, null, null, null); and for each contact I extract a lookup key and a contact id by doing: String lookupKey =…
2
votes
0 answers

Showing app icon in contacts by updating contact in android

I wanted to add my app icon in the contacts app as Whatsapp or Skype does. I have gone through some links and managed to add my add in accounts list of settings. Some of the links are here,here and here. But i am not getting how particular contact…
2
votes
1 answer

How to get group name from a known contact

I am trying to get the group name from a contact name based on a string. I thought this would be a more common question but every answer I have seen on google or here is outdated, has no answers or is incorrectly answered by explaining everything…
SmulianJulian
  • 801
  • 11
  • 33
2
votes
3 answers

ContactsContract.CommonDataKinds.Email.* returns phone number

I'm trying to get email from ContactsContract.CommonDataKinds.Email.ADDRESS and ContactsContract.CommonDataKinds.Email.DATA, ContactsContract.CommonDataKinds.Email.DATA1, all of these do not return email of my contact, which contains an email. I…
Space Ghost
  • 765
  • 2
  • 13
  • 26
2
votes
2 answers

Cannot get email from ContactsContract

No matter what I try, it does not work. I've tried googling and using many examples posted here before, I still keep getting indexOutOfBoundsException. Here is my code snippet. Uri contactData = data.getData(); String[]…
Space Ghost
  • 765
  • 2
  • 13
  • 26
2
votes
1 answer

Getting ContactName using phone number

I am creating an activity which lists out recent calls from a user. The requirement is that when a user receives the call,the phone number and contact name is stored in DB to be later displayed in the activity. To retrieve the contact Name the phone…
2
votes
1 answer

How to add contact number in existing contact having same contact_TYPE in android using ContentProviderOperation android

Can any one tell me how can we add the contact number in existing contact having same contact_TYPE in android using ContentProviderOperation. I tried many this but didn't get any solution yet.
2
votes
0 answers

Sync 30 000 contacts with Contacts API to my app

I made an App that Sync contacts from android contacts repository as follows : when you finish the sign up process It asks you fro syncing your contacts like Facebook does and then it sends all your contacts phone numbers to Server and the servers…
2
votes
0 answers

How do I list all numbers for all contacts even if one contact has multiple numbers associated with it?

I am trying to allow the user to select a contact's phone number by using the default system contact selector. Min SDK is 11 and target is 19, this is the code I'm using the bring up the contact selector: Intent intent = new…
vane
  • 2,125
  • 1
  • 21
  • 40
2
votes
1 answer

How to find a contact's address without using the READ_CONTACTS permission?

I need to get the address of some contact from my contacts list. I use the ACTION_PICK intent in order to do that: Intent intent = new Intent(Intent.ACTION_PICK); …
AVirvara
  • 565
  • 5
  • 7
2
votes
0 answers

Android: Cannot query ContactsContract.Directory on HTC

I wrote a sample app that returns contacts data from GAL (company directory, defined as Exchange ActiveSync in "Accounts"). The very same app works perfectly well on a bunch of different devices, but not on HTC I tested with (One X+ with Android…
igorepst
  • 1,230
  • 1
  • 12
  • 20