# 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)

*** ** * ** ***


```
public final 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/androidx/car/app/HostInfo#HostInfo(java.lang.String,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html packageName, int uid)` Constructs an instance of the HostInfo from the required package name, UID and API level. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/car/app/HostInfo#getPackageName()()` Returns the package name of the host. |
| `int` | `https://developer.android.com/reference/androidx/car/app/HostInfo#getUid()()` Returns the UID of the host. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/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)

```
public HostInfo(@NonNull String packageName, int uid)
```

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

## Public methods

### getPackageName

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

```
public @NonNull String getPackageName()
```

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)

```
public int getUid()
```

Returns the UID of the host.

### toString

```
public @NonNull String toString()
```