android-contacts

ContactsContract.CommonDataKinds.Phone.CONTENT_URI vs ContactsContract.Contacts.CONTENT_URI

你说的曾经没有我的故事 提交于 2019-12-23 18:57:04
问题 In how to retrieve the list of contacts in android I see code that allows you to read contacts using either ContactsContract.CommonDataKinds.Phone.CONTENT_URI or ContactsContract.Contacts.CONTENT_URI . What is the difference between them? When can they be different? 回答1: Use ContactsContract.Contacts to query just Contacts and ContactsContract.CommonDataKinds.Phone can be used to query for details like Phone Numbers if you have the ID of a contact. Be sure to add .CONTENT_URI at the end of

android contacts provider: how to set phone number primary

眉间皱痕 提交于 2019-12-23 17:15:59
问题 How to set a contact's phone number to be primary number when adding or updating a contact building a custom contacts provider. The adding and updating of contacts is working fine but I don't know how to set one number of the contact to be primary, or default number. 回答1: mValues.put(Phone.IS_PRIMARY, 1); mValues.put(Phone.IS_SUPER_PRIMARY, 1); Both Phone.IS_PRIMARY and Phone.IS_SUPER_PRIMARY have to be set. 回答2: I had the same problem, my solution is: ContentProviderOperation.Builder bld =

Accessing the Contact name, Number and Email ID?

风格不统一 提交于 2019-12-23 06:01:16
问题 I am trying to access the contact name number and email ID using this code : import android.app.Activity; import android.content.ContentResolver; import android.database.Cursor; import android.os.Bundle; import android.provider.ContactsContract; public class GetAllDatas extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); readContacts(); } private void

How to retrieve phone numbers/photo id/firstname/lastname within a single request?

纵饮孤独 提交于 2019-12-23 05:35:06
问题 I'm currently using the answer to this question: How to get all contacts first name, last name, email, phone number, etc without duplicates to retrieve the user contact list with, for each contact, all phone numbers, the firstname, lastname and the photo id. The issue I've with that answer is it's creating one request per data wanted. It's creating performances issues on my app. I would like to retrieve all these information from a single request, but I've got a lot of difficulty to

how to get contacts the first name , last name, email id from single query in android

…衆ロ難τιáo~ 提交于 2019-12-23 04:33:48
问题 i want to fetch android contacts details of firstname , lastname, email id from single query. if i fetch the contacts by below process. it is taking lot of time fetching and filtering. Please give the solution to solve this. Presently i am doing in this way . please look into below code. public static JSONArray getMABTosendServer(Context context, UserBean user, DatabaseUserManager userManager) throws JSONException { hashedEmails = new HashMap<String, AddressBean>(); JSONArray jsonArray = new

How to set default image to Android phone contact that has no previous image

橙三吉。 提交于 2019-12-23 02:34:59
问题 I have a piece of code which updates the an Android contact´s image, the problem is that it doesn't work when the contact has no previous image. I also checked that the contact was from "Phone" account or "*@gmail.com" account. When it already has an image with these accounts I have no problem updating the image, the problem is just when the contact has no previous image assigned. Here is the method in charge of updating the image. public void update(long id, Bitmap bitmap) { ArrayList

Insert RawContact with a specific contactid

青春壹個敷衍的年華 提交于 2019-12-22 09:48:38
问题 I am trying to create a rawcontact in android that has a specific contact id, so it is linked to other rawcontacts with the same contactid (not rawcontactid). The problem is I am unable to insert the Contact_ID into the ContentProviderOpertations. Using the following code return "Insert failed" ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); int id = (int) contactId; String condition = Data.RAW_CONTACT_ID + "=?"; String[] parameters = { "" + id }; try {

Set SEND_TO_VOICEMAIL on Android contacts

瘦欲@ 提交于 2019-12-22 09:47:07
问题 I'm trying to modify the value of SEND_TO_VOICEMAIL from 0 to 1 and vice versa. I succeed to modify the others contact's details, such as name, number, nickname, email, ecc... but I need to change SEND_TO_VOICEMAIL. I tried many possibility, but this should work... i guess: String rawContactId = "1"; ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add( ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI) .withSelection( Data.RAW

Set SEND_TO_VOICEMAIL on Android contacts

别说谁变了你拦得住时间么 提交于 2019-12-22 09:46:30
问题 I'm trying to modify the value of SEND_TO_VOICEMAIL from 0 to 1 and vice versa. I succeed to modify the others contact's details, such as name, number, nickname, email, ecc... but I need to change SEND_TO_VOICEMAIL. I tried many possibility, but this should work... i guess: String rawContactId = "1"; ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add( ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI) .withSelection( Data.RAW

permission.READ_CONTACTS does not seem to work

孤街醉人 提交于 2019-12-21 06:59:50
问题 I'm working on a simple app that browses through the user's contacts. Unfortunately I keep getting the following error: java.lang.SecurityException: Permission Denial: reading com.android.providers.contacts.HtcContactsProvider2 uri content://com.android.contacts/contacts from pid=27455, uid=10171 requires android.permission.READ_CONTACTS My manifest file looks like this: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com