ContactsContract.Settings

public static final class ContactsContract.Settings
extends Object implements ContactsContract.SettingsColumns

java.lang.Object
   ↳ android.provider.ContactsContract.Settings


Contacts-specific settings for various Account's.

A settings entry for an account is created automatically when a raw contact or group is inserted that references it. Settings entries cannot be deleted as long as raw contacts or groups continue to reference it; in order to delete a settings entry all raw contacts and groups referencing the account must be deleted first.

Columns

Settings
String ContactsContract.SettingsColumns.ACCOUNT_NAME read/write-once The name of the account instance to which this row belongs.
String ContactsContract.SettingsColumns.ACCOUNT_TYPE read/write-once The type of account to which this row belongs, which when paired with ContactsContract.SettingsColumns.ACCOUNT_NAME identifies a specific account.
int ContactsContract.SettingsColumns.SHOULD_SYNC read/write Depending on the mode defined by the sync-adapter, this flag controls the top-level sync behavior for this data source.
int ContactsContract.SettingsColumns.UNGROUPED_VISIBLE read/write Flag indicating if contacts without any CommonDataKinds.GroupMembership entries should be visible in any user interface.
int ContactsContract.SettingsColumns.ANY_UNSYNCED read-only Read-only flag indicating if this ContactsContract.SettingsColumns.SHOULD_SYNC or any Groups#SHOULD_SYNC under this account have been marked as unsynced.
int ContactsContract.SettingsColumns.UNGROUPED_COUNT read-only Read-only count of Contacts from a specific source that have no CommonDataKinds.GroupMembership entries.
int ContactsContract.SettingsColumns.UNGROUPED_WITH_PHONES read-only Read-only count of Contacts from a specific source that have no CommonDataKinds.GroupMembership entries, and also have phone numbers.

Summary

Constants

String ACTION_SET_DEFAULT_ACCOUNT

Action used to launch the UI to set the default account for new contacts.

String CONTENT_ITEM_TYPE

The MIME-type of CONTENT_URI providing a single setting.

String CONTENT_TYPE

The MIME-type of CONTENT_URI providing a directory of settings.

Inherited constants

Fields

public static final Uri CONTENT_URI

The content:// style URI for this table

Public methods

static Account getDefaultAccount(ContentResolver resolver)

Get the account that is set as the default account for new contacts, which should be initially selected when creating a new contact on contact management apps.

Inherited methods

Constants

ACTION_SET_DEFAULT_ACCOUNT

Added in API level 33
public static final String ACTION_SET_DEFAULT_ACCOUNT

Action used to launch the UI to set the default account for new contacts.

Constant Value: "android.provider.action.SET_DEFAULT_ACCOUNT"

CONTENT_ITEM_TYPE

Added in API level 5
public static final String CONTENT_ITEM_TYPE

The MIME-type of CONTENT_URI providing a single setting.

Constant Value: "vnd.android.cursor.item/setting"

CONTENT_TYPE

Added in API level 5
public static final String CONTENT_TYPE

The MIME-type of CONTENT_URI providing a directory of settings.

Constant Value: "vnd.android.cursor.dir/setting"

Fields

CONTENT_URI

Added in API level 5
public static final Uri CONTENT_URI

The content:// style URI for this table

Public methods

getDefaultAccount

Added in API level 33
public static Account getDefaultAccount (ContentResolver resolver)

Get the account that is set as the default account for new contacts, which should be initially selected when creating a new contact on contact management apps. If the setting has not been set by any app, it will return null. Once the setting is set to non-null Account, it can still be set to null in the future.

Parameters
resolver ContentResolver: the ContentResolver to query. This value cannot be null.

Returns
Account the default account for new contacts, or null if it's not set or set to NULL account.