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
1
vote
0 answers

Launch the Details page for a specific contact in android default contact application from our app

I have created a list of contacts that exists in my phone, sync to all accounts(i.e. SIM1,SIM2, Phone, Google account). Now on the click of my list item I want to open the default contact app's detail page of the user when a given user is…
1
vote
1 answer

Update existing contact with image in Android

I am able to update image in contact from my app and its visible in contacts but as soon as google sync occurs it deletes the image from contact. My code: ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) …
1
vote
1 answer

How to have other apps know what CONTENT_URI to look for?

I have been researching everything I can on Content Providers, but I cannot grasp the concept of how other apps installed on the phone can have access to the Content I am Providing. How can other apps possibly know what my CONTENT_URIs are??? I am…
1
vote
2 answers

Getting null value while retrieving the CONTACT NAME from CONTACT EMAIL

I want to retrieve the contact name from the contact email, so what I have done is as follows from https://stackoverflow.com/a/18064869/5738881. public static String readContacts(Context context, String email) { ContentResolver cr =…
1
vote
1 answer

access to contact data

Alas I have about 500 contacts in my phone book and for some reason after synch'ing them with thunderbird the display name is random last, first...first last. So I thought I would put a quick widget together to just re-do al my display names to…
user438431
  • 335
  • 4
  • 15
1
vote
1 answer

Android ContactsContract.Display_Name returns contact phone number or any other available data

I'm using the code below to get contacts name from the phonebook Uri contactUri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; Cursor phones = getContentResolver().query(contactUri,null,null,null,null); while (phones.moveToNext()) …
Elior
  • 3,178
  • 6
  • 37
  • 67
1
vote
1 answer

Search Phone numbers from Android Contact Database

I am implementing an AutocompleteView to search phone numbers. The code is working fine except in some conditions. My Code : Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; String[] projection = new…
mudit
  • 25,306
  • 32
  • 90
  • 132
1
vote
1 answer

Android. Open the device's Contact list with an Intent not working. Unable to instantiate activity ComponentInfo

This is an experiment for understanding what ContactsContract can offer. I don't know what I've done wrong... Please help me with this problem. My code: package com.example.beni.contactbrowser1; import android.content.Intent; import…
1
vote
1 answer

Android HAS_PHONE_NUMBER

I am trying to write a method that determines if a contact has at least one phone number, at the moment I have this: public boolean hasPhone() { Cursor phones = this.map.getContentResolver().query( ContactsContract.Contacts.CONTENT_URI, null, …
Kanodi
  • 11
  • 2
1
vote
1 answer

Determine whether number from a selected contact is a cellphone or landline?

I am using this code to have the user select a contact to send an sms to: Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); ... @Override protected void…
1
vote
1 answer

How to insert 'profile' contact programmatically in Android?

I'm building an app that accesses a users 'Profile' contact on Android. However, there are some cases where the user may not have a 'Profile' contact set up. In this case, I would like to programatically insert the profile contact. However, I am…
Pratik Thaker
  • 637
  • 2
  • 10
  • 18
1
vote
1 answer

Detect my own phone number using ContactsContract

I have created a class to find phone number in my contact. It looks like this: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data){ if(resultCode == RESULT_OK){ if(requestCode == 1){ …
Sarudu Matra
  • 141
  • 1
  • 1
  • 6
1
vote
1 answer

ContactsContract doesn't work in sony experia

I am trying to import contacts details from phonebook to my app! I can import contact details in almost all phones (Jellybean, Kitkat, Lollipop). But when i tested in Sony Experia(kitkat), the cursor contains no rows. What could be the reason? I…
Darshn
  • 1,512
  • 1
  • 23
  • 31
1
vote
1 answer

What is the best way to query ContactsContract to get Emails, Phones and Addresses at the same time?

As far as I have found, there doesn't seem to be a way to join tables together. I know that I can query for a CommonDataKinds table for Phone, StructuredPostal (address) or Email, but I can't seem to find a way to query for all three of them at…
George Yang
  • 694
  • 6
  • 18
1
vote
0 answers

Display Name Source of Contact Changes if Sync Adapter Supports Uploading which Causes Weird Issues on Contacts App

I have a sync adapter which is observing Contacts Provider and has an associated custom account. Below you can see all rows of the "accounts" table of "contacts2.db" Initially I had a Google contact with the display name "Atakan Kaya". Then I…
atakan
  • 133
  • 1
  • 1
  • 8