[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  
Summary:[Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore#pubmethods)  

# KeyValueStore

`
public


interface
KeyValueStore
`  
`


`

|----------------------------------------------------------|
| android.adservices.ondevicepersonalization.KeyValueStore |

| |
| Known indirect subclasses [MutableKeyValueStore](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/MutableKeyValueStore) |-----------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------| | [MutableKeyValueStore](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/MutableKeyValueStore) | An interface to a read-write key-value store. | |

<br />

*** ** * ** ***

An interface to a read-only key-value store. Used as a Data Access Object for the REMOTE_DATA table.  
**See also:**

- [IsolatedService.getRemoteData(RequestToken)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/IsolatedService#getRemoteData(android.adservices.ondevicepersonalization.RequestToken))

## Summary

|                                                                                                                                                                                                       ### Public methods                                                                                                                                                                                                       ||
|--------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract byte[]`                                                                                                                               | ` `[get](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore#get(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` key) ` Looks up a key in a read-only store. |
| ` abstract `[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | ` `[keySet](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/ondevicepersonalization/KeyValueStore#keySet())`() ` Returns a Set view of the keys contained in the REMOTE_DATA table.                                                     |

## Public methods

### get

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public abstract byte[] get (String key)
```

Looks up a key in a read-only store.  
This method may take several seconds to complete, so it should only be called from a worker thread.

<br />

|                               Parameters                                ||
|-------|------------------------------------------------------------------|
| `key` | `String`: The key to look up. This value cannot be`null`. <br /> |

|                                                      Returns                                                       ||
|----------|----------------------------------------------------------------------------------------------------------|
| `byte[]` | the value to which the specified key is mapped, or null if there contains no mapping for the key. <br /> |

### keySet

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public abstract Set<String> keySet ()
```

Returns a Set view of the keys contained in the REMOTE_DATA table.  
This method may take several seconds to complete, so it should only be called from a worker thread.

<br />

|                                                                                 Returns                                                                                  ||
|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |