---
title: Pass in audience attributes using the Android SDK
slug: feature-experimentation/docs/pass-in-audience-attributes-android
docTags: 
createdAt: 2026-08-05T20:40:02.000Z
---

You can pass strings, numbers, Booleans, and null as user attribute values. If you want to target audiences based on the version of your application that they are using, you can also pass in a string formatted as a [semantic version](https://semver.org/), then define a `version`  audience condition in the app. The following examples show how to pass in attributes.

```kotlin
val attributes: MutableMap<String, Any> = HashMap()
attributes["device"] = "iPhone"
attributes["lifetime"] = 24738388
attributes["is_logged_in"] = true
attributes["application_version"] = "4.3.0-beta"

val user = optimizelyClient.createUserContext("user123", attributes)
val decision = user!!.decide("FLAG_KEY_HERE")
```

```java
Map<String, Object> attributes = new HashMap<>();
attributes.put("device", "iPhone");
attributes.put("lifetime", 24738388);
attributes.put("is_logged_in", true);
attributes.put("application_version", "4.3.0-beta");

OptimizelyUserContext user = optimizelyClient.createUserContext("user123", attributes);
OptimizelyDecision decision = user.decide("FLAG_KEY_HERE");
```

:::hint{type="warning"}
**Important**
During audience evaluation, if you do not pass a valid attribute value for a given audience condition—for example, if you pass a string when the audience condition requires a Boolean, or if you forget to pass a value—then that condition is skipped. The [SDK logs](docId\:CoBZxvxqT3P_9b6EUcq7p) will include warnings when this occurs.
:::
