# ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState

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

# DefaultAccountAndState

*** ** * ** ***

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

```
class DefaultAccountAndState
```

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

Represents the state of the default account, and the actual[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)if it's a cloud account. If the default account is set to[DEFAULT_ACCOUNT_STATE_LOCAL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_LOCAL:kotlin.Int)or[DEFAULT_ACCOUNT_STATE_CLOUD](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD:kotlin.Int), new raw contacts requested for insertion without a specified[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)will be saved in the default account. The default account can have one of the following four states:

- [DEFAULT_ACCOUNT_STATE_NOT_SET](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_NOT_SET:kotlin.Int): The default account has not been set by the user.
- [DEFAULT_ACCOUNT_STATE_LOCAL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_LOCAL:kotlin.Int): The default account is set to the local device storage. New raw contacts requested for insertion without a specified[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)will be saved in a null or custom local account.
- [DEFAULT_ACCOUNT_STATE_CLOUD](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD:kotlin.Int): The default account is set to a cloud-synced account. New raw contacts requested for insertion without a specified[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)will be saved in the default cloud account.
- [DEFAULT_ACCOUNT_STATE_SIM](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_SIM:kotlin.Int): The default account is set to a account that is associated with one of[SimContacts.getSimAccounts(ContentResolver)](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.SimContacts#getSimAccounts(android.content.ContentResolver)). New raw contacts requested for insertion without a specified[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)will be saved in this SIM account.

<br />

## Summary

|                                                                                                                                                                                                                                                                                     Constants                                                                                                                                                                                                                                                                                      ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEFAULT_ACCOUNT_STATE_CLOUD](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD:kotlin.Int) A state indicating that the default account is set as an account that is synced to the cloud.                                                                                                                                                                                           |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEFAULT_ACCOUNT_STATE_LOCAL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_LOCAL:kotlin.Int) A state indicating that default account is set to local device storage.                                                                                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEFAULT_ACCOUNT_STATE_NOT_SET](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_NOT_SET:kotlin.Int) A state indicating that default account is not set.                                                                                                                                                                                                                                 |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEFAULT_ACCOUNT_STATE_SIM](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_SIM:kotlin.Int) A state indicating that the default account is set as an account that is associated with one of[SimContacts.getSimAccounts(ContentResolver)](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.SimContacts#getSimAccounts(android.content.ContentResolver)). |

|                                                                                                                                                                                                                                                                                                                            Public methods                                                                                                                                                                                                                                                                                                                             ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                                                                                                              | [equals](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#equals(kotlin.Any))`(`other:` `[Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)?`)` <br />                                                                                                                                                                                     |
| [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)?                                                                                                                       | [getAccount](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#getAccount())`()` <br />                                                                                                                                                                                                                                                                             |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                      | [getState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#getState())`()` <br />                                                                                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                                                                                      | [hashCode](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#hashCode())`()` <br />                                                                                                                                                                                                                                                                                 |
| static[ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | [ofCloud](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#ofCloud(android.accounts.Account))`(`cloudAccount:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)`)` Creates a \`DefaultAccountAndState\` instance representing a default account that is set to the cloud and associated with the specified cloud account. |
| static[ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | [ofLocal](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#ofLocal())`()` Creates a \`DefaultAccountAndState\` instance representing a default account that is set to the local device storage.                                                                                                                                                                    |
| static[ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | [ofNotSet](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#ofNotSet())`()` Creates a \`DefaultAccountAndState\` instance representing a default account that is not set.                                                                                                                                                                                          |
| static[ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | [ofSim](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#ofSim(android.accounts.Account))`(`simAccount:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)`)` Creates a \`DefaultAccountAndState\` instance representing a default account that is set to the sim and associated with the specified sim account.           |

## Constants

### DEFAULT_ACCOUNT_STATE_CLOUD

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

```
static val DEFAULT_ACCOUNT_STATE_CLOUD: Int
```

A state indicating that the default account is set as an account that is synced to the cloud.  

    Value: 3

### DEFAULT_ACCOUNT_STATE_LOCAL

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

```
static val DEFAULT_ACCOUNT_STATE_LOCAL: Int
```

A state indicating that default account is set to local device storage.  

    Value: 2

### DEFAULT_ACCOUNT_STATE_NOT_SET

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

```
static val DEFAULT_ACCOUNT_STATE_NOT_SET: Int
```

A state indicating that default account is not set.  

    Value: 1

### DEFAULT_ACCOUNT_STATE_SIM

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

```
static val DEFAULT_ACCOUNT_STATE_SIM: Int
```

A state indicating that the default account is set as an account that is associated with one of[SimContacts.getSimAccounts(ContentResolver)](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.SimContacts#getSimAccounts(android.content.ContentResolver)).  

    Value: 4

## Public methods

### equals

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

```
fun equals(other: Any?): Boolean
```

|                     Parameters                     ||
|-------|---------------------------------------------|
| `obj` | the reference object with which to compare. |

|                                                                           Return                                                                           ||
|------------------------------------------------------------------------------------|------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if this object is the same as the obj argument;`false`otherwise. |

### getAccount

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

```
fun getAccount(): Account?
```

|                                                                                                                                                                                                                                                                                                  Return                                                                                                                                                                                                                                                                                                  ||
|-------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)? | the cloud account associated with the default account if the state is[DEFAULT_ACCOUNT_STATE_CLOUD](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD:kotlin.Int)or[DEFAULT_ACCOUNT_STATE_SIM](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_SIM:kotlin.Int). This value may be`null`. |

### getState

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

```
fun getState(): Int
```

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    Return                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | the state of the default account. Value is[android.provider.ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_NOT_SET](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_NOT_SET:kotlin.Int),[android.provider.ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_LOCAL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_LOCAL:kotlin.Int),[android.provider.ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD:kotlin.Int), or[android.provider.ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_SIM](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_SIM:kotlin.Int) |

### hashCode

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

```
fun hashCode(): Int
```

|                                                     Return                                                     ||
|----------------------------------------------------------------------------|------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a hash code value for this object. |

### ofCloud

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

```
static fun ofCloud(cloudAccount: Account): ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState
```

Creates a \`DefaultAccountAndState\` instance representing a default account that is set to the cloud and associated with the specified cloud account.

|                                                                                    Parameters                                                                                     ||
|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `cloudAccount` | [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#):The non-null cloud account associated with the default contacts account. |

|                                                                                                                                                                                                                                                Return                                                                                                                                                                                                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | A new \`DefaultAccountAndState\` instance with state[DEFAULT_ACCOUNT_STATE_CLOUD](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_CLOUD:kotlin.Int). This value cannot be`null`. |

### ofLocal

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

```
static fun ofLocal(): ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState
```

Creates a \`DefaultAccountAndState\` instance representing a default account that is set to the local device storage.

|                                                                                                                                                                                                                                                Return                                                                                                                                                                                                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | A new \`DefaultAccountAndState\` instance with state[DEFAULT_ACCOUNT_STATE_LOCAL](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_LOCAL:kotlin.Int). This value cannot be`null`. |

### ofNotSet

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

```
static fun ofNotSet(): ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState
```

Creates a \`DefaultAccountAndState\` instance representing a default account that is not set.

|                                                                                                                                                                                                                                                  Return                                                                                                                                                                                                                                                  ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | A new \`DefaultAccountAndState\` instance with state[DEFAULT_ACCOUNT_STATE_NOT_SET](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_NOT_SET:kotlin.Int). This value cannot be`null`. |

### ofSim

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

```
static fun ofSim(simAccount: Account): ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState
```

Creates a \`DefaultAccountAndState\` instance representing a default account that is set to the sim and associated with the specified sim account.

|                                                                                  Parameters                                                                                   ||
|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `simAccount` | [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#):The non-null sim account associated with the default contacts account. |

|                                                                                                                                                                                                                                              Return                                                                                                                                                                                                                                              ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#) | A new \`DefaultAccountAndState\` instance with state[DEFAULT_ACCOUNT_STATE_SIM](https://developer.android.com/reference/kotlin/android/provider/ContactsContract.RawContacts.DefaultAccount.DefaultAccountAndState#DEFAULT_ACCOUNT_STATE_SIM:kotlin.Int). This value cannot be`null`. |