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
1 answer

Setting MIMETYPE of Data for ContactsContract in Adapter or Fragment

In my application I am seeking to display contact details of ContactsContract.CommonDataKinds.Organization.TITLE Within the ContactsContract, the MIMETYPE is used to choose the identity of the column of most of the useful data from the phone. I am…
1
vote
2 answers

Query on contact list for select contacts - Multiple URI Android?

How can I set query on ContactsContract.CommonDataKinds.Email and ContactsContract.CommonDataKinds.Phone in one query and get ID, Name, PhoneNumber and Email .... ? Like bellow code : private void getContactList() { String id = ""; …
1
vote
2 answers

LAST_TIME_CONTACTED has unexpected value

When I try to get the last time that I contacted some contacts, the results has the value converted to "01/01/1970" but I know the real date and time of the last call (for example, it is 14/02/2016). I noted that in my logs the last saved call is…
1
vote
1 answer

How to pick contact's non default phone number?

I am starting contact picker activity to get phone number val i = Intent(Intent.ACTION_PICK) i.type = ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE startActivityForResult(i, REQUEST_CODE_PICK_CONTACT) If contact has no default…
Joe Rakhimov
  • 4,713
  • 9
  • 51
  • 109
1
vote
1 answer

Support CursorLoader with EXTRA_ADDRESS_BOOK_INDEX

I am using a support CursorLoader to load Contacts. When using an API larger than 21, I call loader.setUri(ContactsContract.Data.CONTENT_URI.buildUpon().appendQueryParameter(ContactsContract.Data.EXTRA_ADDRESS_BOOK_INDEX, "true").build()); Meaning…
1
vote
1 answer

Function to update a photo in ContactsContract

I try to update a photo in ContactsContract with a function who take the id of the contact and the uri of the picture but it seem it's not working (and my function return true). I really don't understand because the code look good. It seem it's…
Jéwôm'
  • 3,753
  • 5
  • 40
  • 73
1
vote
1 answer

How to load an address from a contacts directory?

I am trying to load addresses from a G Suite contacts directory (or an Exchange Global Address List) under Android. This directory does not implement the full ContactsContract but only e.g. CONTENT_FILTER_URI and maybe a few others. I can load the…
Dominique
  • 2,356
  • 1
  • 19
  • 19
1
vote
1 answer

Update contact pictures - support other providers like outlook

The code at the bottom shows how I update contact pictures from my app. This works well, if the user uses sim, phone and google contacts and similar. But if he uses the outlook app, the outlook app does overwrite the images set by my app again after…
prom85
  • 16,896
  • 17
  • 122
  • 242
1
vote
1 answer

android email address getting and storing and displaying

I am new to android. So I request you to be patient with me. I am trying to write an application where on pressing a button the contacts API is opened. Then the user chooses the contact. Then I want to get the chosen contact in onAcitvityResult(int…
Brahadeesh
  • 2,245
  • 8
  • 40
  • 58
1
vote
1 answer

Selecting an account for saving contacts

I am making a phone book application. I can see some of contacts has different ACCOUNT_TYPE_AND_DATA_SET (com.whatsapp, com.viber.voip, com.google, com.android.huawei.sim, com.android.huawei.phone etc). Here is the question: how can I get the list…
1
vote
1 answer

contentResolver.query(ContactsContract.Contacts.CONTENT_URI...) return 0 count Cursor if called after Intent.ACTION_INSERT

I'm getting a weird behavior when testing my app on Huawei P8. Everything works nice on emulators (android version 4, 5, 6, 7) and on ASUS (android 6) and Samsung Galaxy S2 (Android 4.2). The following steps work both on physical device and…
MDP
  • 4,177
  • 21
  • 63
  • 119
1
vote
0 answers

android registerContentObserver for Contacts requires READ_CONTACTS permission

I just discovered that, during app initialization my registerContentObserver for Contacts requires READ_CONTACTS permission. Obviously, for a new user on Android 6 and later, this permission won't yet be granted. It seems to me it would be…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
1
vote
1 answer

Save Contacts as "Phone contact"

Is there way to programmatically adds the contact to the internal phone contacts book as a "phone contact"? I've tried: list.add(ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) …
Siarhei
  • 2,358
  • 3
  • 27
  • 63
1
vote
1 answer

How to get LOOKUP_KEY of a Contact from ContactsContract.Contacts?

I have to select a Contact from an android device Contacts list. With the following code I retrieve an activity with the list of the contacts on the device: Intent intent = new Intent(Intent.ACTION_PICK,…
MDP
  • 4,177
  • 21
  • 63
  • 119
1
vote
1 answer

Created contacts not showing up on HTC Evo

I'm writing a program that imports our contacts into the Contacts db on the phone so they show up in the Contacts app, are available for caller id to draw from, etc. I've got it working the way we want on the emulator and the Motorola Droid. When I…
atraudes
  • 2,368
  • 2
  • 21
  • 31