ContactsPickerSessionContract.ActionPickContacts Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Intent action to launch the system Contacts Picker to select one or more contacts.
[Android.Runtime.Register("ACTION_PICK_CONTACTS", ApiSince=37)]
public const string ActionPickContacts;
[<Android.Runtime.Register("ACTION_PICK_CONTACTS", ApiSince=37)>]
val mutable ActionPickContacts : string
Field Value
- Attributes
Remarks
Intent action to launch the system Contacts Picker to select one or more contacts. This action provides a modern way for applications to obtain contact information, differing from Intent.ACTION_PICK and Intent.ACTION_GET_CONTENT in several key ways: It is specifically designed for picking contacts, offering a streamlined user experience; The calling application gains one-time read access to the user-selected contact data, without requiring Manifest.permission.READ_CONTACTS; Users benefit from a consistent UI to grant temporary access to their contact data; Client applications can specify and receive multiple data fields (MIME types) corresponding to the selected contacts
To use this intent, create an Intent with this action and launch it using Activity.startActivityForResult(android.content.Intent, int). The system Contacts Picker UI will be displayed, allowing the user to select one or more contacts. This contacts picker UI will:; Have eligible contacts displayed as a scrollable list to the user; Enable users to select single/multiple contacts; Enable users to search for contacts using display name
The display and selection behavior can be customized using the following extras:; EXTRA_PICK_CONTACTS_REQUESTED_DATA_FIELDS: (Required) Specifies the MIME types of contact data to be displayed in the picker and returned to the calling app. Contacts must have at least one of the specified MIME types, to be shown as available for selection; EXTRA_PICK_CONTACTS_MATCH_ALL_DATA_FIELDS: (Optional) If set to true, only contacts possessing data for *all* MIME types specified in EXTRA_PICK_CONTACTS_REQUESTED_DATA_FIELDS will be shown as available for selection. Defaults to false; EXTRA_PICK_CONTACTS_SELECTION_LIMIT: (Optional) Defines the maximum number of contacts the user can select. Defaults to 50, with a maximum allowed value of 100; Intent.EXTRA_ALLOW_MULTIPLE: (Optional) If set to true, the user can select multiple contacts. The default behavior is single-select.
Upon successful contact(s) selection, the Activity.onActivityResult(int, int, android.content.Intent) callback will be invoked with Activity.RESULT_OK. The returned Intent will contain a session URI in its data field (see Session.CONTENT_URI), which should be used to query the selected contact data.
Uri sessionUri = data.getData();
Cursor cursor = getContentResolver().query(sessionUri, projection, null, null, null);
// Process cursor data
Starting from Android 17, this intent is handled by a system application by default. Third-party applications should not handle this intent as they will be ignored when the system attempts to resolve it.
Android reference for android.provider.ContactsPickerSessionContract.ACTION_PICK_CONTACTS.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.