rawcontacts

How to display phone contacts only (exclude SIM contacts)

二次信任 提交于 2020-01-21 15:18:26
问题 I'm building an UI where I need to show a list of phone contacts in a list view. I'm using ContactsContract.Data and the CursorLoader to load the data and then binding the cursor to a custom adapter (extended off of SimpleCursorAdapter ). The issue here is that I can't figure out how to filter out the SIM contacts; a test phone I have has identical contacts on the phone as well as the SIM, which causes the listview to have duplicate entries. If I remove the SIM, the duplicates go away. How

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 {

Android: Accessing and querying properly using Raw Contact Id

半世苍凉 提交于 2019-12-11 22:54:19
问题 So my app is attempting to integrate a sync adapter to the android native contact manager. This is all running smoothly except once a contact is synced, I am unable to update it. Details on this particular problem can be found here: Android: Content resolver query returning 0 rows when it ought not to But I can sum it up simply by just saying my content resolver query is returning 0 values because I am querying the wrong URI, I believe. When I write the raw contact id to the phone, I do it

ContentProvider (contacts) - no such column: metadata_dirty

為{幸葍}努か 提交于 2019-12-11 06:54:08
问题 I'm trying to get all contacts of a specific type from the phone like following: Cursor cursor = context.getContentResolver().query( ContactsContract.RawContacts.CONTENT_URI, null, ContactsContract.RawContacts.ACCOUNT_TYPE + "='com.whatsapp'", null, ContactsContract.RawContacts.CONTACT_ID + " ASC"); But this line already throws an exception (custom rom, nougat => maybe it's related to this?). I only got this error from one user yet and I'm stuck here, does anyone know how to solve that? Is

Get RawContact photo

混江龙づ霸主 提交于 2019-12-11 05:45:56
问题 I know it is possible to get the contact's photo using something like: public InputStream getContactPhotoInputStream() throws IOException { Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(mContactId)); InputStream is = ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, uri); return is; } But now I need to access all RawContact's photo (the one that have one). But I can't. From ContactsContract.RawContacts.DisplayPhoto documentation, the

Merging raw contacts

三世轮回 提交于 2019-12-10 23:42:58
问题 I have an account and a sync adapter which add new raw contacts with corresponding private data entries. the contacts I'm creating are phone number based, meaning I'm creating a new entry per existing phone number. How do I merge my raw contact with the existing raw contact that was linked to the existing phone number? I've tried creating a new phone number entry in the data table, and link it to the raw contacts I'm adding. it works, but It's creating a duplication phone number. I've also

Insert RawContact with a specific contactid

◇◆丶佛笑我妖孽 提交于 2019-12-06 01:42:23
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 { String accountName = account.name; String accountType = account.type; ops.add(ContentProviderOperation

Save Contacts as “Phone contact”

本秂侑毒 提交于 2019-12-01 13:29:37
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) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null) .build()); with this parameters contact successfully saves to the phone, but in case i set up filter to "display phone contacts only" - created contact not appears. btw, i've read that contacts with null type can be loses drying accounts synchronization (haven't remember