# ContactsContract.Directory

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Directory

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/provider/ContactsContract.Directory "View this page in Java")  

```
class Directory : BaseColumns
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                             ||
| ↳ | [android.provider.ContactsContract.Directory](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#) |

A Directory represents a contacts corpus, e.g. Local contacts, Google Apps Global Address List or Corporate Global Address List.

A Directory is implemented as a content provider with its unique authority and the same API as the main Contacts Provider. However, there is no expectation that every directory provider will implement this Contract in its entirety. If a directory provider does not have an implementation for a specific request, it should throw an UnsupportedOperationException.

The most important use case for Directories is search. A Directory provider is expected to support at least[Contacts.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri). If a Directory provider wants to participate in email and phone lookup functionalities, it should also implement[CommonDataKinds.Email.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.CommonDataKinds.Email#CONTENT_FILTER_URI:android.net.Uri)and[CommonDataKinds.Phone.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.CommonDataKinds.Phone#CONTENT_FILTER_URI:android.net.Uri).

A directory provider should return NULL for every projection field it does not recognize, rather than throwing an exception. This way it will not be broken if ContactsContract is extended with new fields in the future.

The client interacts with a directory via Contacts Provider by supplying an optional`directory=`query parameter.

<br />

When the Contacts Provider receives the request, it transforms the URI and forwards the request to the corresponding directory content provider. The URI is transformed in the following fashion:

- The URI authority is replaced with the corresponding[DIRECTORY_AUTHORITY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#DIRECTORY_AUTHORITY:kotlin.String).
- The`accountName=`and`accountType=`parameters are added or replaced using the corresponding[ACCOUNT_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_TYPE:kotlin.String)and[ACCOUNT_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_NAME:kotlin.String)values.

<br />

Clients should send directory requests to Contacts Provider and let it forward them to the respective providers rather than constructing directory provider URIs by themselves. This level of indirection allows Contacts Provider to implement additional system-level features and optimizations. Access to Contacts Provider is protected by the READ_CONTACTS permission, but access to the directory provider is protected by BIND_DIRECTORY_SEARCH. This permission was introduced at the API level 17, for previous platform versions the provider should perform the following check to make sure the call is coming from the ContactsProvider:  

```kotlin
private boolean isCallerAllowed() {
    PackageManager pm = getContext().getPackageManager();
    for (String packageName: pm.getPackagesForUid(Binder.getCallingUid())) {
      if (packageName.equals("com.android.providers.contacts")) {
        return true;
      }
    }
    return false;
  }
  
```

<br />

The Directory table is read-only and is maintained by the Contacts Provider automatically.

It always has at least these two rows:

- The local directory. It has[Directory._ID](https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String)=[Directory.DEFAULT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#DEFAULT:kotlin.Long). This directory can be used to access locally stored contacts. The same can be achieved by omitting the`directory=`parameter altogether.
- The local invisible contacts. The corresponding directory ID is[Directory.LOCAL_INVISIBLE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#LOCAL_INVISIBLE:kotlin.Long).

<br />

Custom Directories are discovered by the Contacts Provider following this procedure:

- It finds all installed content providers with meta data identifying them as directory providers in AndroidManifest.xml:` <meta-data android:name="android.content.ContactDirectory" android:value="true" /> `

  This tag should be placed inside the corresponding content provider declaration.
- Then Contacts Provider sends a[Directory.CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri)query to each of the directory authorities. A directory provider must implement this query and return a list of directories. Each directory returned by the provider must have a unique combination for the[ACCOUNT_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_NAME:kotlin.String)and[ACCOUNT_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_TYPE:kotlin.String)columns (nulls are allowed). Since directory IDs are assigned automatically, the _ID field will not be part of the query projection.
- Contacts Provider compiles directory lists received from all directory providers into one, assigns each individual directory a globally unique ID and stores all directory records in the Directory table.

<br />

Contacts Provider automatically interrogates newly installed or replaced packages. Thus simply installing a package containing a directory provider is sufficient to have that provider registered. A package supplying a directory provider does not have to contain launchable activities.

Every row in the Directory table is automatically associated with the corresponding package (apk). If the package is later uninstalled, all corresponding directory rows are automatically removed from the Contacts Provider.

When the list of directories handled by a directory provider changes (for instance when the user adds a new Directory account), the directory provider should call[notifyDirectoryChange](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#notifyDirectoryChange(android.content.ContentResolver))to notify the Contacts Provider of the change. In response, the Contacts Provider will requery the directory provider to obtain the new list of directories.

A directory row can be optionally associated with an existing account (see[android.accounts.AccountManager](https://developer.android.com/reference/kotlin/android/accounts/AccountManager.html#)). If the account is later removed, the corresponding directory rows are automatically removed from the Contacts Provider.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                         Constants                                                                                                                                                                                                                                                                                                                                                                                          ||
|----------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [ACCOUNT_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_NAME:kotlin.String) The account with which this directory is associated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [ACCOUNT_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_TYPE:kotlin.String) The account type which this directory is associated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [CALLER_PACKAGE_PARAM_KEY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CALLER_PACKAGE_PARAM_KEY:kotlin.String) A query parameter that's passed to directory providers which indicates the client package name that has made the query requests.                                                                                                                                                                                                                                                                                                                                                                                                     |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [CONTENT_ITEM_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_ITEM_TYPE:kotlin.String) The MIME type of a[CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri)item.                                                                                                                                                                                                                                                                                                                                                                                       |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [CONTENT_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_TYPE:kotlin.String) The MIME-type of[CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri)providing a directory of contact directories.                                                                                                                                                                                                                                                                                                                                                           |
| static[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)     | [DEFAULT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#DEFAULT:kotlin.Long) _ID of the default directory, which represents locally stored contacts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [DIRECTORY_AUTHORITY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#DIRECTORY_AUTHORITY:kotlin.String) The authority of the Directory Provider.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [DISPLAY_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#DISPLAY_NAME:kotlin.String) An optional name that can be used in the UI to represent this directory, e.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| static[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)     | [ENTERPRISE_DEFAULT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ENTERPRISE_DEFAULT:kotlin.Long) _ID of the managed profile default directory, which represents locally stored contacts.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| static[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)     | [ENTERPRISE_LOCAL_INVISIBLE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ENTERPRISE_LOCAL_INVISIBLE:kotlin.Long) _ID of the managed profile directory that represents locally stored invisible contacts.                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String) One of[EXPORT_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_NONE:kotlin.Int),[EXPORT_SUPPORT_ANY_ACCOUNT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_ANY_ACCOUNT:kotlin.Int),[EXPORT_SUPPORT_SAME_ACCOUNT_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_SAME_ACCOUNT_ONLY:kotlin.Int).                                                        |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [EXPORT_SUPPORT_ANY_ACCOUNT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_ANY_ACCOUNT:kotlin.Int) An[EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String)setting that indicates that the directory allow its data copied to any contacts account.                                                                                                                                                                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [EXPORT_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_NONE:kotlin.Int) An[EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String)setting that indicates that the directory does not allow any data to be copied out of it.                                                                                                                                                                                                                                                                                                              |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [EXPORT_SUPPORT_SAME_ACCOUNT_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_SAME_ACCOUNT_ONLY:kotlin.Int) An[EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String)setting that indicates that the directory allow its data copied only to the account specified by[ACCOUNT_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_TYPE:kotlin.String)/[ACCOUNT_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_NAME:kotlin.String). |
| static[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)     | [LOCAL_INVISIBLE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#LOCAL_INVISIBLE:kotlin.Long) _ID of the directory that represents locally stored invisible contacts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [PACKAGE_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PACKAGE_NAME:kotlin.String) The name of the package that owns this directory.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String) One of[PHOTO_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_NONE:kotlin.Int),[PHOTO_SUPPORT_THUMBNAIL_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_THUMBNAIL_ONLY:kotlin.Int),[PHOTO_SUPPORT_FULL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_FULL:kotlin.Int).                                                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [PHOTO_SUPPORT_FULL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_FULL:kotlin.Int) An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory can produce thumbnails as well as full-size contact photos.                                                                                                                                                                                                                                                                                                      |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [PHOTO_SUPPORT_FULL_SIZE_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_FULL_SIZE_ONLY:kotlin.Int) An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory has full-size contact photos, but cannot provide scaled thumbnails.                                                                                                                                                                                                                                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [PHOTO_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_NONE:kotlin.Int) An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory does not provide any photos.                                                                                                                                                                                                                                                                                                                                     |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [PHOTO_SUPPORT_THUMBNAIL_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_THUMBNAIL_ONLY:kotlin.Int) An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory can only produce small size thumbnails of contact photos.                                                                                                                                                                                                                                                                                    |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String) One of[SHORTCUT_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_NONE:kotlin.Int),[SHORTCUT_SUPPORT_DATA_ITEMS_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_DATA_ITEMS_ONLY:kotlin.Int),[SHORTCUT_SUPPORT_FULL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_FULL:kotlin.Int).                                                          |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [SHORTCUT_SUPPORT_DATA_ITEMS_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_DATA_ITEMS_ONLY:kotlin.Int) An[SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String)setting that indicates that the directory allow creation of shortcuts for data items like email, phone or postal address, but not the entire contact.                                                                                                                                                                                                                    |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [SHORTCUT_SUPPORT_FULL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_FULL:kotlin.Int) An[SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String)setting that indicates that the directory allow creation of shortcuts for contact as well as their constituent elements.                                                                                                                                                                                                                                                                       |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)       | [SHORTCUT_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_NONE:kotlin.Int) An[SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String)setting that indicates that the directory does not allow any shortcuts created for its contacts.                                                                                                                                                                                                                                                                                               |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [TYPE_RESOURCE_ID](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#TYPE_RESOURCE_ID:kotlin.String) The type of directory captured as a resource ID in the context of the package[PACKAGE_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PACKAGE_NAME:kotlin.String), e.                                                                                                                                                                                                                                                                                                                               |

| Inherited constants ||
|---|---|
| From class[BaseColumns](https://developer.android.com/reference/kotlin/android/provider/BaseColumns) |----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [_COUNT](https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_COUNT:kotlin.String) <br /> The count of rows in a directory. Type: INTEGER <br /> | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [_ID](https://developer.android.com/reference/kotlin/android/provider/BaseColumns#_ID:kotlin.String) <br /> The unique ID for a row. Type: INTEGER (long) <br />         | ||

|                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                             ||
|------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isEnterpriseDirectoryId](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#isEnterpriseDirectoryId(kotlin.Long))`(`directoryId:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Return TRUE if a directory ID is from the contacts provider on the enterprise profile.                                                          |
| static[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isRemoteDirectoryId](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#isRemoteDirectoryId(kotlin.Long))`(`directoryId:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Return TRUE if it is a remote stored directory.                                                                                                         |
| static[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)       | [notifyDirectoryChange](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#notifyDirectoryChange(android.content.ContentResolver))`(`resolver:` `[ContentResolver](https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#)!`)` Notifies the system of a change in the list of directories handled by a particular directory provider. |

|                                                                                                                                                                          Properties                                                                                                                                                                           ||
|------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | [CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri) The content:// style URI for this table.                                                                                            |
| static[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)! | [ENTERPRISE_CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ENTERPRISE_CONTENT_URI:android.net.Uri) URI used for getting all directories from both the calling user and the managed profile that is linked to it. |

## Constants

### ACCOUNT_NAME

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ACCOUNT_NAME: String
```

The account with which this directory is associated. If the account is later removed, the directories it owns are automatically removed from this table.

TYPE: text  

    Value: "accountName"

### ACCOUNT_TYPE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ACCOUNT_TYPE: String
```

The account type which this directory is associated.

TYPE: text  

    Value: "accountType"

### CALLER_PACKAGE_PARAM_KEY

Added in[API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CALLER_PACKAGE_PARAM_KEY: String
```

A query parameter that's passed to directory providers which indicates the client package name that has made the query requests.  

    Value: "callerPackage"

### CONTENT_ITEM_TYPE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CONTENT_ITEM_TYPE: String
```

The MIME type of a[CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri)item.  

    Value: "vnd.android.cursor.item/contact_directory"

### CONTENT_TYPE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CONTENT_TYPE: String
```

The MIME-type of[CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri)providing a directory of contact directories.  

    Value: "vnd.android.cursor.dir/contact_directories"

### DEFAULT

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val DEFAULT: Long
```

_ID of the default directory, which represents locally stored contacts.**This is only supported by[ContactsContract.Contacts.CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_URI:android.net.Uri)and[ContactsContract.Contacts.CONTENT_FILTER_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Contacts#CONTENT_FILTER_URI:android.net.Uri). Other URLs do not support the concept of "visible" or "invisible" contacts.**  

    Value: 0L

### DIRECTORY_AUTHORITY

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val DIRECTORY_AUTHORITY: String
```

The authority of the Directory Provider. Contacts Provider will use this authority to forward requests to the directory provider. A directory provider can leave this column empty - Contacts Provider will fill it in.

Clients of this API should not send requests directly to this authority. All directory requests must be routed through Contacts Provider.

TYPE: text  

    Value: "authority"

### DISPLAY_NAME

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val DISPLAY_NAME: String
```

An optional name that can be used in the UI to represent this directory, e.g. "Acme Corp"

TYPE: text  

    Value: "displayName"

### ENTERPRISE_DEFAULT

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ENTERPRISE_DEFAULT: Long
```

_ID of the managed profile default directory, which represents locally stored contacts.  

    Value: 1000000000L

### ENTERPRISE_LOCAL_INVISIBLE

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ENTERPRISE_LOCAL_INVISIBLE: Long
```

_ID of the managed profile directory that represents locally stored invisible contacts.  

    Value: 1000000001L

### EXPORT_SUPPORT

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EXPORT_SUPPORT: String
```

One of[EXPORT_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_NONE:kotlin.Int),[EXPORT_SUPPORT_ANY_ACCOUNT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_ANY_ACCOUNT:kotlin.Int),[EXPORT_SUPPORT_SAME_ACCOUNT_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT_SAME_ACCOUNT_ONLY:kotlin.Int). This is the expectation the directory has for data exported from it. Clients must obey this setting.  

    Value: "exportSupport"

### EXPORT_SUPPORT_ANY_ACCOUNT

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EXPORT_SUPPORT_ANY_ACCOUNT: Int
```

An[EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String)setting that indicates that the directory allow its data copied to any contacts account.  

    Value: 2

### EXPORT_SUPPORT_NONE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EXPORT_SUPPORT_NONE: Int
```

An[EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String)setting that indicates that the directory does not allow any data to be copied out of it.  

    Value: 0

### EXPORT_SUPPORT_SAME_ACCOUNT_ONLY

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val EXPORT_SUPPORT_SAME_ACCOUNT_ONLY: Int
```

An[EXPORT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#EXPORT_SUPPORT:kotlin.String)setting that indicates that the directory allow its data copied only to the account specified by[ACCOUNT_TYPE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_TYPE:kotlin.String)/[ACCOUNT_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#ACCOUNT_NAME:kotlin.String).  

    Value: 1

### LOCAL_INVISIBLE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val LOCAL_INVISIBLE: Long
```

_ID of the directory that represents locally stored invisible contacts.  

    Value: 1L

### PACKAGE_NAME

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PACKAGE_NAME: String
```

The name of the package that owns this directory. Contacts Provider fill it in with the name of the package containing the directory provider. If the package is later uninstalled, the directories it owns are automatically removed from this table.

TYPE: TEXT  

    Value: "packageName"

### PHOTO_SUPPORT

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PHOTO_SUPPORT: String
```

One of[PHOTO_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_NONE:kotlin.Int),[PHOTO_SUPPORT_THUMBNAIL_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_THUMBNAIL_ONLY:kotlin.Int),[PHOTO_SUPPORT_FULL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT_FULL:kotlin.Int). This is a feature flag indicating the extent to which the directory supports contact photos.  

    Value: "photoSupport"

### PHOTO_SUPPORT_FULL

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PHOTO_SUPPORT_FULL: Int
```

An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory can produce thumbnails as well as full-size contact photos.  

    Value: 3

### PHOTO_SUPPORT_FULL_SIZE_ONLY

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PHOTO_SUPPORT_FULL_SIZE_ONLY: Int
```

An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory has full-size contact photos, but cannot provide scaled thumbnails.  

    Value: 2

### PHOTO_SUPPORT_NONE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PHOTO_SUPPORT_NONE: Int
```

An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory does not provide any photos.  

    Value: 0

### PHOTO_SUPPORT_THUMBNAIL_ONLY

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val PHOTO_SUPPORT_THUMBNAIL_ONLY: Int
```

An[PHOTO_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PHOTO_SUPPORT:kotlin.String)setting that indicates that the directory can only produce small size thumbnails of contact photos.  

    Value: 1

### SHORTCUT_SUPPORT

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SHORTCUT_SUPPORT: String
```

One of[SHORTCUT_SUPPORT_NONE](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_NONE:kotlin.Int),[SHORTCUT_SUPPORT_DATA_ITEMS_ONLY](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_DATA_ITEMS_ONLY:kotlin.Int),[SHORTCUT_SUPPORT_FULL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT_FULL:kotlin.Int). This is the expectation the directory has for shortcuts created for its elements. Clients must obey this setting.  

    Value: "shortcutSupport"

### SHORTCUT_SUPPORT_DATA_ITEMS_ONLY

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SHORTCUT_SUPPORT_DATA_ITEMS_ONLY: Int
```

An[SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String)setting that indicates that the directory allow creation of shortcuts for data items like email, phone or postal address, but not the entire contact.  

    Value: 1

### SHORTCUT_SUPPORT_FULL

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SHORTCUT_SUPPORT_FULL: Int
```

An[SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String)setting that indicates that the directory allow creation of shortcuts for contact as well as their constituent elements.  

    Value: 2

### SHORTCUT_SUPPORT_NONE

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val SHORTCUT_SUPPORT_NONE: Int
```

An[SHORTCUT_SUPPORT](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#SHORTCUT_SUPPORT:kotlin.String)setting that indicates that the directory does not allow any shortcuts created for its contacts.  

    Value: 0

### TYPE_RESOURCE_ID

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val TYPE_RESOURCE_ID: String
```

The type of directory captured as a resource ID in the context of the package[PACKAGE_NAME](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#PACKAGE_NAME:kotlin.String), e.g. "Corporate Directory"

TYPE: INTEGER  

    Value: "typeResourceId"

## Public methods

### isEnterpriseDirectoryId

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static fun isEnterpriseDirectoryId(directoryId: Long): Boolean
```

Return TRUE if a directory ID is from the contacts provider on the enterprise profile.  

### isRemoteDirectoryId

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static fun isRemoteDirectoryId(directoryId: Long): Boolean
```

Return TRUE if it is a remote stored directory.  

### notifyDirectoryChange

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static fun notifyDirectoryChange(resolver: ContentResolver!): Unit
```

Notifies the system of a change in the list of directories handled by a particular directory provider. The Contacts provider will turn around and send a query to the directory provider for the full list of directories, which will replace the previous list.

## Properties

### CONTENT_URI

Added in[API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CONTENT_URI: Uri!
```

The content:// style URI for this table. Requests to this URI can be performed on the UI thread because they are always unblocking.  

### ENTERPRISE_CONTENT_URI

Added in[API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val ENTERPRISE_CONTENT_URI: Uri!
```

URI used for getting all directories from both the calling user and the managed profile that is linked to it.

It supports the same semantics as[CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri)and returns the same columns.  
If the device has no managed profile that is linked to the calling user, it behaves in the exact same way as[CONTENT_URI](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.Directory#CONTENT_URI:android.net.Uri).  
If there is a managed profile linked to the calling user, it will return merged results from both.

Note: this query returns the calling user results before the managed profile results, and this order is not affected by the sorting parameter.