# HostInfo

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/HostInfo.java+class:androidx.car.app.HostInfo) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.0.0)

*** ** * ** ***


```
class HostInfo
```

<br />

*** ** * ** ***

Container class for information about the host the app is connected to.

Apps can use this information to determine how they will respond to the host. For example, a host which is not recognized could receive a message screen while an authorized host could receive full access to the app's capabilities.

The package name and uid can used to query the system package manager for a signature or to determine if the host has a system signature.

The host API level can be used to adjust the models exchanged with the host to those valid for the specific host version the app is connected to.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/car/app/HostInfo#HostInfo(java.lang.String,int)(packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, uid: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Constructs an instance of the HostInfo from the required package name, UID and API level. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/HostInfo#getPackageName()()` Returns the package name of the host. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/HostInfo#getUid()()` Returns the UID of the host. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/HostInfo#toString()()` |

## Public constructors

### HostInfo

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

```
HostInfo(packageName: String, uid: Int)
```

Constructs an instance of the HostInfo from the required package name, UID and API level.

## Public functions

### getPackageName

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

```
fun getPackageName(): String
```

Returns the package name of the host.

### getUid

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

```
fun getUid(): Int
```

Returns the UID of the host.

### toString

```
fun toString(): String
```