# SyncStateContract.Helpers

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

# Helpers

*** ** * ** ***

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

```
class Helpers
```

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

## Summary

|                                                     Public constructors                                                      ||
|---------------------------------------------------------------------------------------------------------------------------|---|
| [Helpers](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#Helpers())`()` <br /> |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!                                                                                                                                                                 | [get](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#get(android.content.ContentProviderClient,%20android.net.Uri,%20android.accounts.Account))`(`provider:` `[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `account:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!`)` Get the sync state that is associated with the account or null.                                                                                                                         |
| static[Pair](https://developer.android.com/reference/kotlin/android/util/Pair.html#)\<[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!,[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!\>! | [getWithUri](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#getWithUri(android.content.ContentProviderClient,%20android.net.Uri,%20android.accounts.Account))`(`provider:` `[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `account:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!`)` <br />                                                                                                                                                                    |
| static[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!                                                                                                                                                                             | [insert](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#insert(android.content.ContentProviderClient,%20android.net.Uri,%20android.accounts.Account,%20kotlin.ByteArray))`(`provider:` `[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `account:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` <br />                                                    |
| static[ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.html#)!                                                                                                                               | [newSetOperation](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#newSetOperation(android.net.Uri,%20android.accounts.Account,%20kotlin.ByteArray))`(`uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `account:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Creates and returns a ContentProviderOperation that assigns the data array as the sync state for the given account.                                                                                                  |
| static[ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.html#)!                                                                                                                               | [newUpdateOperation](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#newUpdateOperation(android.net.Uri,%20kotlin.ByteArray))`(`uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Creates and returns a ContentProviderOperation that assigns the data array as the sync state for the given account.                                                                                                                                                                                                                                |
| static[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                             | [set](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#set(android.content.ContentProviderClient,%20android.net.Uri,%20android.accounts.Account,%20kotlin.ByteArray))`(`provider:` `[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `account:` `[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` Assigns the data array as the sync state for the given account. |
| static[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                                                                                                                             | [update](https://developer.android.com/reference/kotlin/android/provider/SyncStateContract.Helpers#update(android.content.ContentProviderClient,%20android.net.Uri,%20kotlin.ByteArray))`(`provider:` `[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!`, `uri:` `[Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!`, `data:` `[ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!`)` <br />                                                                                                                                                                                        |

## Public constructors

### Helpers

```
Helpers()
```

## Public methods

### get

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

```
static fun get(
    provider: ContentProviderClient!, 
    uri: Uri!, 
    account: Account!
): ByteArray!
```

Get the sync state that is associated with the account or null.

|                                                                                                                                                                                                                      Parameters                                                                                                                                                                                                                       ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `provider` | [ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!:the[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)that is to be used to communicate with the[android.content.ContentProvider](https://developer.android.com/reference/kotlin/android/content/ContentProvider.html#)that contains the sync state. |
| `uri`      | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!:the uri of the sync state                                                                                                                                                                                                                                                                                                                                    |
| `account`  | [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!:the[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)whose sync state should be returned                                                                                                                                                                                                                  |

|                                                                                 Return                                                                                 ||
|------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|
| [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)! | the sync state or null if there is no sync state associated with the account |

|                                                                                                Exceptions                                                                                                ||
|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `android.os.RemoteException` | if there is a failure communicating with the remote[android.content.ContentProvider](https://developer.android.com/reference/kotlin/android/content/ContentProvider.html#) |

### getWithUri

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

```
static fun getWithUri(
    provider: ContentProviderClient!, 
    uri: Uri!, 
    account: Account!
): Pair<Uri!, ByteArray!>!
```  

### insert

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

```
static fun insert(
    provider: ContentProviderClient!, 
    uri: Uri!, 
    account: Account!, 
    data: ByteArray!
): Uri!
```  

### newSetOperation

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

```
static fun newSetOperation(
    uri: Uri!, 
    account: Account!, 
    data: ByteArray!
): ContentProviderOperation!
```

Creates and returns a ContentProviderOperation that assigns the data array as the sync state for the given account.

|                                                                                                           Parameters                                                                                                           ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `uri`     | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!:the uri of the sync state                                                                                                              |
| `account` | [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!:the[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)whose sync state should be set |
| `data`    | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!:the byte\[\] that contains the sync state                                                                                  |

|                                                                                                        Return                                                                                                        ||
|----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.html#)! | the new ContentProviderOperation that assigns the data array as the account's sync state |

### newUpdateOperation

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

```
static fun newUpdateOperation(
    uri: Uri!, 
    data: ByteArray!
): ContentProviderOperation!
```

Creates and returns a ContentProviderOperation that assigns the data array as the sync state for the given account.

|                                                                 Parameters                                                                 ||
|--------|------------------------------------------------------------------------------------------------------------------------------------|
| `uri`  | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!:the uri of the specific sync state to set             |
| `data` | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!:the byte\[\] that contains the sync state |

|                                                                                                        Return                                                                                                        ||
|----------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [ContentProviderOperation](https://developer.android.com/reference/kotlin/android/content/ContentProviderOperation.html#)! | the new ContentProviderOperation that assigns the data array as the account's sync state |

### set

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

```
static fun set(
    provider: ContentProviderClient!, 
    uri: Uri!, 
    account: Account!, 
    data: ByteArray!
): Unit
```

Assigns the data array as the sync state for the given account.

|                                                                                                                                                                                                                      Parameters                                                                                                                                                                                                                       ||
|------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `provider` | [ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)!:the[ContentProviderClient](https://developer.android.com/reference/kotlin/android/content/ContentProviderClient.html#)that is to be used to communicate with the[android.content.ContentProvider](https://developer.android.com/reference/kotlin/android/content/ContentProvider.html#)that contains the sync state. |
| `uri`      | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#)!:the uri of the sync state                                                                                                                                                                                                                                                                                                                                    |
| `account`  | [Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)!:the[Account](https://developer.android.com/reference/kotlin/android/accounts/Account.html#)whose sync state should be set                                                                                                                                                                                                                       |
| `data`     | [ByteArray](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-byte-array/index.html)!:the byte\[\] that contains the sync state                                                                                                                                                                                                                                                                                                        |

|                                                                                                Exceptions                                                                                                ||
|------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `android.os.RemoteException` | if there is a failure communicating with the remote[android.content.ContentProvider](https://developer.android.com/reference/kotlin/android/content/ContentProvider.html#) |

### update

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

```
static fun update(
    provider: ContentProviderClient!, 
    uri: Uri!, 
    data: ByteArray!
): Unit
```