contactscontract

Get user/owner profile contact URI and user image with API 8 onwards

一曲冷凌霜 提交于 2019-12-10 18:44:20
问题 From API 14 (Android 4.0 onwards) onwards I can use ContactsContract.Profile.CONTENT_URI to get the phone owner's contact profile Uri, and through that obtain their avatar/contact photo. I want to know how to do this from API 8 (Android 2.2) through to API 13. I only need the photo (so it's okay if there is no concept of a user profile contact prior to API 14), although I'm by no means certain that it is actually possible. 回答1: Pre API 14, there is no concept of the user profile prior to API

Getting RawContact id using Contact id

半城伤御伤魂 提交于 2019-12-09 07:33:31
问题 I have built the following method to obtain the id from the RawContacts table using the id obtained from the Contacts table.This method fails thrwoing an Exception. public int getRawContactId(int contactId) { String[] projection=new String[]{ContactsContract.RawContacts._ID}; String selection=ContactsContract.RawContacts.CONTACT_ID+"=?"; String[] selectionArgs=new String[]{String.valueOf(contactId)}; Cursor c=context.getContentResolver().query(ContactsContract.RawContacts.CONTENT_URI

How to show custom type contact inside Contact like WhatsApp android

*爱你&永不变心* 提交于 2019-12-09 06:31:15
问题 /** * Account type id */ public static final String ACCOUNT_TYPE = "com.test.app"; /** * Account name */ public static final String ACCOUNT_NAME = "Test"; public static void addContact(Context context, User contact) { ContentResolver resolver = context.getContentResolver(); resolver.delete(RawContacts.CONTENT_URI, RawContacts.ACCOUNT_TYPE + " = ?", new String[] { AccountConstants.ACCOUNT_TYPE }); ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>(); ops.add

Get Android contacts with type-to-filter functionality, restricted to a specific account

荒凉一梦 提交于 2019-12-08 19:11:58
问题 I'm trying to: Display a list of contacts Let the user search through them by typing a query Limit search results only to a specific Google/Gmail account. This is how I build the URI for the cursor: // User is searching for 'jo' String query = "jo"; Uri uri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(query)); // Restrict the query to contacts from 'example@gmail.com' Uri.Builder builder = uri.buildUpon(); builder.appendQueryParameter( ContactsContract.DIRECTORY_PARAM_KEY,

ContentObserver for contact update manually

穿精又带淫゛_ 提交于 2019-12-08 17:37:09
问题 I have registered a ContentObserver from service and I get the onchange() function when there is update in phone like call or contact update. But I want the onchange() function to be called only when add, update or delete happens. But I don't want when call is incoming or outgoing. So can anybody tell me which URI I can register in contentObserver ? My code is here getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true,new Contact_change()); and Contact

Get contacts from contact group based on group ID

泄露秘密 提交于 2019-12-08 13:22:12
问题 I have a found a great code on how to retrieve contact groups from the phone: final String[] GROUP_PROJECTION = new String[] {ContactsContract.Groups._ID, ContactsContract.Groups.TITLE }; Cursor cursor = getContentResolver().query(ContactsContract.Groups.CONTENT_URI, GROUP_PROJECTION, null, null, ContactsContract.Groups.TITLE); while (cursor.moveToNext()) { String id = cursor.getString(cursor.getColumnIndex(ContactsContract.Groups._ID)); String gTitle = (cursor.getString(cursor.getColumnIndex

Contacts - how to distinguish between SIM, phone and other contacts?

只愿长相守 提交于 2019-12-08 03:20:42
问题 I'm reading ALL contacts from the phone like following: Cursor cursor = MainApp.get().getContentResolver().query( ContactsContract.Data.CONTENT_URI, null, null, null, ContactsContract.Data.CONTACT_ID + " ASC"); I read ContactsContract.Data.ACCOUNT_TYPE_AND_DATA_SET and ContactsContract.RawContacts.ACCOUNT_NAME from the contacts and analysed them because I want to distinguish between phone, sim and any other contact... But I only can see that the values are very phone specific. 1) I currently

Load a contact's picture into a listview instead of the default?

时间秒杀一切 提交于 2019-12-07 20:32:25
问题 I created a listview containing my contacts... tab_contact_list.xml , contains the listview: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ListView android:id="@+id/tab_contact_list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" /> </LinearLayout> listview_detail_tab_contact

Displaying contacts only with phone numbers using ACTION_PICK intent in Android device

巧了我就是萌 提交于 2019-12-06 22:14:05
问题 My goal is to only display contacts with phone number to user and let user select few contacts which I want to store locally. I have used various options in place of ContactsContract.Contacts.CONTENT_URI in below method. But I am getting lot many of the contacts (many are junk with only email ids) displayed. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.contact_selector); ((Button)findViewById(R.id.btnphonecontactlist))

How to get contact name details for a particular contact

与世无争的帅哥 提交于 2019-12-06 15:15:33
问题 I want the Name of the Contact which includes (FAMILY_NAME, GIVEN_NAME,MIDDLE_NAME,PHONETIC_FAMILY_NAME,PHONETIC_GIVEN_NAME,PHONETIC_MIDDLE_NAME,PREFIX,SUFFIX). I know that column names of the above data that starts with android.provider.ContactsContract.CommonDataKinds.StructuredName But i am unable to get the URI of the data. I was working on device with api level 8 so i want to fetch these details using android.provider.ContactsContract I have searched about this in commumnity but i can't