contactscontract

Android: Retrieve contact name from phone number

主宰稳场 提交于 2019-11-26 17:28:19
I would like to retrieve the name of a contact associated with an incoming telephone number. As I process the incoming number in the broascastreceiver having a String with the name of the incoming caller would help my project greatly. I would think this involves a query using the sql WHERE clause as a filter, but do I need to sort the contacts? An example or hint would be of great assistance. Pentium10 For that you need to use the optimized PhoneLookup provider as described. Add the permission to AndroidManifest.xml : <uses-permission android:name="android.permission.READ_CONTACTS"/> Then:

What is the default Account Type / Name for contacts on Android Contact Application?

╄→гoц情女王★ 提交于 2019-11-26 16:44:14
问题 I would like to read contacts from ContactsContract API which belongs only to Phone / SIM and would like to avoid contacts synced from other apps like facebook and gmail. I tested my code on simulator and it works fine but on real devices it doesn't returns any result. ContentResolver cr = AndroidContext.getContext() .getContentResolver(); Cursor nativeContacts = cr.query(RawContacts.CONTENT_URI, new String[] { RawContacts._ID, RawContacts.VERSION, RawContacts.CONTACT_ID }, RawContacts

New contacts created using ContactsContract do not appear in Contacts app

99封情书 提交于 2019-11-26 16:38:36
问题 I'm using the following piece of codes to create a new contact. It follow closely the ContactManager example provided by Android. The problem is, the created contacts do not appear in the Contacts app that shipped with Android. Nevertheless, when I load all the contacts from the phonebook, I can see the newly created contacts. private void insertPBEntry() throws RemoteException, OperationApplicationException { ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>()

How do I load a contact Photo?

依然范特西╮ 提交于 2019-11-26 12:07:15
I'm having trouble loading a photo for a contact in Android. I've googled for an answer, but so far have come up empty. Does anyone have an example of querying for a Contact, then loading the Photo? So, given a contactUri which comes from an Activity result called using startActivityForResult(new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI),PICK_CONTACT_REQUEST) is: content://com.android.contacts/data/1557 The loadContact(..) works fine. However when I call the getPhoto(...) method, I get a null value for the photo InputStream. It is also confusing because the

Retrieve Contact Phone Number From URI in Android

冷暖自知 提交于 2019-11-26 09:48:33
问题 I am trying to get the contact\'s phone number after I have retrieved their ID number from the built-in activity. However, whenever I query the database using the cursor in my code below -- I get zero rows returned even though there is a mobile number for the contact I have selected. Can anyone point me in a better direction or show an example of how to get the contact\'s phone number AFTER getting their userID? My code: private Runnable getSMSRunnable() { return new Runnable() { public void

Android contacts Display Name and Phone Number(s) in single database query?

╄→尐↘猪︶ㄣ 提交于 2019-11-26 06:59:45
问题 I\'m trying to obtain a list of contacts from the native database with their Display Name and Phone Number (any or all). There are many methods for obtaining this information with several queries to the phone\'s database, but this introduces considerable overhead. Here is the query I\'ve been working on, but it results in Uri uri = ContactsContract.Contacts.CONTENT_URI; String[] projection = new String[] { ContactsContract.Contacts._ID, ContactsContract.Contacts.DISPLAY_NAME, ContactsContract

Android: Retrieve contact name from phone number

久未见 提交于 2019-11-26 05:26:24
问题 I would like to retrieve the name of a contact associated with an incoming telephone number. As I process the incoming number in the broascastreceiver having a String with the name of the incoming caller would help my project greatly. I would think this involves a query using the sql WHERE clause as a filter, but do I need to sort the contacts? An example or hint would be of great assistance. 回答1: For that you need to use the optimized PhoneLookup provider as described. Add the permission to

get contact info from android contact picker

时光毁灭记忆、已成空白 提交于 2019-11-26 03:48:49
I'm trying to call the contact picker, get the persons name, phone and e-mail into strings and send them to another activity using an intent. So far this works: Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, 1); // ... @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData(); Cursor c = managedQuery(contactData, null, null, null, null); if (c.moveToFirst()) { String name = c

How do I load a contact Photo?

独自空忆成欢 提交于 2019-11-26 02:50:26
问题 I\'m having trouble loading a photo for a contact in Android. I\'ve googled for an answer, but so far have come up empty. Does anyone have an example of querying for a Contact, then loading the Photo? So, given a contactUri which comes from an Activity result called using startActivityForResult(new Intent(Intent.ACTION_PICK,ContactsContract.CommonDataKinds.Phone.CONTENT_URI),PICK_CONTACT_REQUEST) is: content://com.android.contacts/data/1557 The loadContact(..) works fine. However when I call

get contact info from android contact picker

烈酒焚心 提交于 2019-11-26 01:52:57
问题 I\'m trying to call the contact picker, get the persons name, phone and e-mail into strings and send them to another activity using an intent. So far this works: Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI); startActivityForResult(intent, 1); // ... @Override public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { Uri contactData = data.getData()