AppInfo

@CarProtocol
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

const 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(
    minCarAppApiLevel: Int,
    latestCarAppApiLevel: Int,
    libraryVersion: String
)

Creates an instance of AppInfo with the provided version information.

Public functions

Int
String

String representation of library version.

Int
String!

Constants

MIN_API_LEVEL_METADATA_KEY

Added in 1.1.0
const val MIN_API_LEVEL_METADATA_KEY = "androidx.car.app.minCarApiLevel": String!

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
AppInfo(
    minCarAppApiLevel: Int,
    latestCarAppApiLevel: Int,
    libraryVersion: String
)

Creates an instance of AppInfo with the provided version information.

Parameters
minCarAppApiLevel: Int

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

latestCarAppApiLevel: Int

the latest API level the library supports

libraryVersion: String

the library artifact version

Public functions

getLatestCarAppApiLevel

Added in 1.0.0
fun getLatestCarAppApiLevel(): Int

getLibraryDisplayVersion

Added in 1.0.0
fun getLibraryDisplayVersion(): String

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

getMinCarAppApiLevel

Added in 1.0.0
fun getMinCarAppApiLevel(): Int

toString

Added in 1.4.0-rc02
fun toString(): String!