# SessionInfoIntentEncoder

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/SessionInfoIntentEncoder.java+class:androidx.car.app.SessionInfoIntentEncoder) Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

*** ** * ** ***


```
class SessionInfoIntentEncoder
```

<br />

*** ** * ** ***

Helper to encode and decode a `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo` from an `https://developer.android.com/reference/android/content/Intent.html`

## Summary

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfoIntentEncoder#containsSessionInfo(android.content.Intent)(intent: https://developer.android.com/reference/android/content/Intent.html)` Returns whether or not the given `intent` contains an encoded `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo` | `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfoIntentEncoder#decode(android.content.Intent)(intent: https://developer.android.com/reference/android/content/Intent.html)` Decodes a new `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo` for a given `intent` |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfoIntentEncoder#encode(androidx.car.app.SessionInfo,android.content.Intent)(sessionInfo: https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo, intent: https://developer.android.com/reference/android/content/Intent.html)` Sets the unique identifier for the given `intent` and encodes the passed `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo` in its extras. |

## Public functions

### containsSessionInfo

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

```
java-static fun containsSessionInfo(intent: Intent): Boolean
```

Returns whether or not the given `intent` contains an encoded `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo`.

### decode

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

```
java-static fun decode(intent: Intent): SessionInfo
```

Decodes a new `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo` for a given `intent`

### encode

Added in [1.3.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.3.0)

```
java-static fun encode(sessionInfo: SessionInfo, intent: Intent): Unit
```

Sets the unique identifier for the given `intent` and encodes the passed `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo` in its extras.

The intent identifier that's created is unique based on `https://developer.android.com/reference/kotlin/androidx/car/app/SessionInfo#toString()`. The `https://developer.android.com/reference/android/content/Intent.html` field that's set is either `https://developer.android.com/reference/android/content/Intent.html#setIdentifier(java.lang.String)` on API 29 and above, or `https://developer.android.com/reference/android/content/Intent.html#setData(android.net.Uri)`.