Android 12 Developer Preview is here! Try it out, and give us your feedback!

HostInfo

public class HostInfo
extends Object

java.lang.Object
   ↳ com.google.android.libraries.car.app.HostInfo


Container class for information about the host the service 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.

Summary

Public constructors

HostInfo(String packageName, int uid)

Constructs an instance of the HostInfo from the required package name and uid.

Public methods

String getPackageName()

Retrieves the package name of the host.

int getUid()

Retrieves the uid of the host.

Inherited methods

Public constructors

HostInfo

public HostInfo (String packageName, 
                int uid)

Constructs an instance of the HostInfo from the required package name and uid.

Parameters
packageName String

uid int

Public methods

getPackageName

public String getPackageName ()

Retrieves the package name of the host.

Returns
String

getUid

public int getUid ()

Retrieves the uid of the host.

Returns
int