android-contacts

Getting null value while retrieving the CONTACT NAME from CONTACT EMAIL

萝らか妹 提交于 2019-12-11 10:47:09
问题 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 = context.getContentResolver(); Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(email)); Cursor cursor = cr.query(uri, new String[]{ContactsContract.PhoneLookup.DISPLAY_NAME}, null, null, null); if (cursor == null) { return

PickContact requires android.permission.READ_CONTACTS, or grantUriPermission()

家住魔仙堡 提交于 2019-12-11 09:59:25
问题 Some info first: I first created the app in Cordova: see Cordova permissions requires android.permission.READ_CONTACTS, or grantUriPermission() Now i created the app as a native Android app using Android Studio Builder, it has the same error. I'm using Android 6.0 ( SDK 23) According to the docs, ContactPick doesn't need permissions: http://developer.android.com/guide/components/intents-common.html#Contacts The result Intent delivered to your onActivityResult() callback contains the content:

How can I put the updated phone number into the field I picked for my Android app?

ぐ巨炮叔叔 提交于 2019-12-11 09:01:20
问题 How can I put the updated phone number into the field I picked? I have the picker returning the phone number but in the wrong field. After picking a contact the phone number is placed in the wrong field. My fragment responsible for this contact picker logic is in my repo https://github.com/jackygrahamez/MayDay/blob/gradle2/app/src/main/java/com/mayday/md/common/ContactPickerFragment.java How might I refactor this code to put the number in the correct field? 02-23 12:47:59.217 12360-12360/com

When I select contact name and address from contact list address data not retrieved

给你一囗甜甜゛ 提交于 2019-12-11 07:55:29
问题 I need to get contact name and relevant address from contact list in android. I get the contact name and their phone number, but unfortunately unable to get the address details. When I select the contact address, it will return null every time. I searched the google as well as stackoverflow. But unable to find a solution. When I searched I found that, address details are in another separate table, but I searched that table with id, but didn't return the data from the address table. So please

How to get non duplicated phone numbers from android contacts content provider

拥有回忆 提交于 2019-12-11 07:41:12
问题 I am trying to get all contacts which have mobile numbers. I am able to fetch the contacts.But the problem is it gives me duplicate contacts.same phone number comes two times. I used the following code to get contacts. public static List<RawContact> getAllContacts(Context context,Account account){ Log.d(TAG, "*** Looking for local contacts with mobile number!!"); String phoneNumber = null; String email = null; int numberOfContacts = 0; List<RawContact> newContacts = new ArrayList<RawContact>(

how to get contact name by sending contact number in android?

可紊 提交于 2019-12-11 07:37:52
问题 if there any method to get contact name by send contact number in android.if any one have idea . private String getContactName(String string) { String name=null; ContentResolver cr = getContentResolver(); Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,null,null,null, null); if (cur.getCount() > 0) { while (cur.moveToNext()) { String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)); name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts

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

Update Contact Data by Data ID

好久不见. 提交于 2019-12-11 06:46:39
问题 My application uses the Contacts ContentProvider to store some of its data. When I load a contact into memory, I want to save its ID (so that I know how to save changes later), and the ID of all data fields it is using (so they can be directly updated). Here is some of my code: Uri entityUri = Uri.withAppendedPath( ContentUris.withAppendedId(RawContacts.CONTENT_URI, id), Entity.CONTENT_DIRECTORY); Cursor resultData = context.getContentResolver().query( entityUri, new String[]{RawContacts

How can i show a pre populated postal address in contacts screen with street , city , zip on android

混江龙づ霸主 提交于 2019-12-11 05:35:30
问题 I am using following code for populating contacts in Android: Intent addContactIntent = new Intent(Intent.ACTION_INSERT); addContactIntent.setType(ContactsContract.Contacts.CONTENT_TYPE); addContactIntent.putExtra(ContactsContract.Intents.Insert.NAME, "Store Name"); addContactIntent.putExtra(ContactsContract.Intents.Insert.PHONE, "1-869-270-9099"); addContactIntent.putExtra(ContactsContract.Intents.Insert.POSTAL, "postal address");* But I also need to populate city, street and zip in postal

Adding new contact with photo via ContactsContract and ContentProvider

好久不见. 提交于 2019-12-11 03:08:12
问题 I've been trying all day to add contact with photo to Android Contacts. Finally I'm adding picture to contact, but I can't add any name or phone number. Contact is displaying as "(Unknown)", with proper photo. My code: private void addContact2() { final String displayName = "XYZA"; final String mobileNumber = "666666"; final byte[] photoByteArray; // initalized elsewhere ArrayList<ContentProviderOperation> ops = new ArrayList<>(); ops.add(ContentProviderOperation.newInsert(ContactsContract