CarInfo


@RequiresCarApi(value = 3)
@MainThread
interface CarInfo


Manages access to car hardware specific info such as model, energy, and speed info.

Summary

Public functions

Unit

Setup an ongoing listener to receive EnergyLevel information from the car hardware.

Unit

Setup an ongoing listener to receive EvStatus information from the car hardware.

Unit
addMileageListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<Mileage!>
)

Setup an ongoing listener to receive Mileage information from the car hardware.

Unit
addSpeedListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<Speed!>
)

Setup an ongoing listener to receive Speed information from the car hardware.

Unit
addTollListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<TollCard!>
)

Setup an ongoing listener to receive TollCard information from the car hardware.

Unit
fetchEnergyProfile(
    executor: Executor,
    listener: OnCarDataAvailableListener<EnergyProfile!>
)

Reguest the EnergyProfile information about the car hardware.

Unit

Request the ExteriorDimensions information about the vehicle.

Unit
fetchModel(
    executor: Executor,
    listener: OnCarDataAvailableListener<Model!>
)

Fetch the Model information about the car hardware.

Unit

Remove an ongoing listener for EnergyLevel information.

Unit

Remove an ongoing listener for EvStatus information.

Unit

Remove an ongoing listener for Mileage information.

Unit

Remove an ongoing listener for Speed information.

Unit

Remove an ongoing listener for TollCard information.

Public functions

addEnergyLevelListener

Added in 1.1.0
fun addEnergyLevelListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<EnergyLevel!>
): Unit

Setup an ongoing listener to receive EnergyLevel information from the car hardware.

If the listener was added previously then it won't be added.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<EnergyLevel!>

the listener that will be invoked when data is available

addEvStatusListener

Added in 1.2.0
@ExperimentalCarApi
fun addEvStatusListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<EvStatus!>
): Unit

Setup an ongoing listener to receive EvStatus information from the car hardware.

If the listener was added previously then it won't be added.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<EvStatus!>

the listener that will be invoked when data is available

addMileageListener

Added in 1.1.0
fun addMileageListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<Mileage!>
): Unit

Setup an ongoing listener to receive Mileage information from the car hardware.

If the listener was added previously then it won't be added.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<Mileage!>

the listener that will be invoked when data is available

addSpeedListener

Added in 1.1.0
fun addSpeedListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<Speed!>
): Unit

Setup an ongoing listener to receive Speed information from the car hardware.

If the listener was added previously then it won't be added.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<Speed!>

the listener that will be invoked when data is available

addTollListener

Added in 1.1.0
fun addTollListener(
    executor: Executor,
    listener: OnCarDataAvailableListener<TollCard!>
): Unit

Setup an ongoing listener to receive TollCard information from the car hardware.

If the listener was added previously then it won't be added again.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<TollCard!>

the listener that will be invoked when data is available

fetchEnergyProfile

Added in 1.1.0
fun fetchEnergyProfile(
    executor: Executor,
    listener: OnCarDataAvailableListener<EnergyProfile!>
): Unit

Reguest the EnergyProfile information about the car hardware.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<EnergyProfile!>

the listener that will be invoked when data is available

fetchExteriorDimensions

Added in 1.7.0-beta02
@RequiresCarApi(value = 7)
fun fetchExteriorDimensions(
    executor: Executor,
    listener: OnCarDataAvailableListener<ExteriorDimensions!>
): Unit

Request the ExteriorDimensions information about the vehicle. This will only return meaningful data on select Automotive vehicles running SDK 30 and above.

This requires the android.car.permission.CAR_INFO permission.

See VehiclePropertyIds#INFO_EXTERIOR_DIMENSIONS

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<ExteriorDimensions!>

the listener that will be invoked when data is available

fetchModel

Added in 1.1.0
fun fetchModel(
    executor: Executor,
    listener: OnCarDataAvailableListener<Model!>
): Unit

Fetch the Model information about the car hardware.

Parameters
executor: Executor

the executor which will be used for invoking the listener

listener: OnCarDataAvailableListener<Model!>

the listener that will be invoked when data is available

removeEnergyLevelListener

Added in 1.1.0
fun removeEnergyLevelListener(
    listener: OnCarDataAvailableListener<EnergyLevel!>
): Unit

Remove an ongoing listener for EnergyLevel information.

If the listener is not currently added, then nothing will be removed.

Parameters
listener: OnCarDataAvailableListener<EnergyLevel!>

the listener to remove

removeEvStatusListener

Added in 1.2.0
@ExperimentalCarApi
fun removeEvStatusListener(listener: OnCarDataAvailableListener<EvStatus!>): Unit

Remove an ongoing listener for EvStatus information.

If the listener is not currently added, then nothing will be removed.

Parameters
listener: OnCarDataAvailableListener<EvStatus!>

the listener to remove

removeMileageListener

Added in 1.1.0
fun removeMileageListener(listener: OnCarDataAvailableListener<Mileage!>): Unit

Remove an ongoing listener for Mileage information.

If the listener is not currently added, then nothing will be removed.

Parameters
listener: OnCarDataAvailableListener<Mileage!>

the listener to remove

removeSpeedListener

Added in 1.1.0
fun removeSpeedListener(listener: OnCarDataAvailableListener<Speed!>): Unit

Remove an ongoing listener for Speed information.

If the listener is not currently added, then nothing will be removed.

Parameters
listener: OnCarDataAvailableListener<Speed!>

the listener to remove

removeTollListener

Added in 1.1.0
fun removeTollListener(listener: OnCarDataAvailableListener<TollCard!>): Unit

Remove an ongoing listener for TollCard information.

If the listener is not currently added, then nothing will be removed.

Parameters
listener: OnCarDataAvailableListener<TollCard!>

the listener to remove