AppInfo


@CarProtocol
public final class AppInfo


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

Hosts will use this information to provide the right level of compatibility, based on the application's minimum and maximum API level and its own set of supported API levels.

The application minimum API level is defined in the application's manifest using the following declaration.

<manifest ...>
  <application ...>
    <meta-data
        android:name="androidx.car.app.minCarApiLevel"
        android:value="1" />
    ...
  </application>
</manifest>

Summary

Constants

static final String
MIN_API_LEVEL_METADATA_KEY = "androidx.car.app.minCarApiLevel"

Application meta-data tag used to define the minimum Car App API level this application is able to handle.

Public constructors

@VisibleForTesting
AppInfo(
    int minCarAppApiLevel,
    int latestCarAppApiLevel,
    @NonNull String libraryVersion
)

Creates an instance of AppInfo with the provided version information.

Public methods

int
@NonNull String

String representation of library version.

int
String

Constants

MIN_API_LEVEL_METADATA_KEY

Added in 1.1.0
public static final String MIN_API_LEVEL_METADATA_KEY = "androidx.car.app.minCarApiLevel"

Application meta-data tag used to define the minimum Car App API level this application is able to handle.

If not specified, the library assumes the application can only handle the Car App API level designed by getLatest at the time of compiling.

Public constructors

AppInfo

Added in 1.0.0
@VisibleForTesting
public AppInfo(
    int minCarAppApiLevel,
    int latestCarAppApiLevel,
    @NonNull String libraryVersion
)

Creates an instance of AppInfo with the provided version information.

Parameters
int minCarAppApiLevel

the minimal API level that can work with an app built with the library

int latestCarAppApiLevel

the latest API level the library supports

@NonNull String libraryVersion

the library artifact version

Public methods

getLatestCarAppApiLevel

Added in 1.0.0
public int getLatestCarAppApiLevel()

getLibraryDisplayVersion

Added in 1.0.0
public @NonNull String getLibraryDisplayVersion()

String representation of library version. This version string is opaque and not meant to be parsed.

getMinCarAppApiLevel

Added in 1.0.0
public int getMinCarAppApiLevel()

toString

public String toString()