CarInfo


@RequiresCarApi(value = 3)
@MainThread
public interface CarInfo


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

Summary

Public methods

abstract void

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

abstract void

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

abstract void

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

abstract void

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

abstract void

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

abstract void

Reguest the EnergyProfile information about the car hardware.

default void

Request the ExteriorDimensions information about the vehicle.

abstract void
fetchModel(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<Model> listener
)

Fetch the Model information about the car hardware.

abstract void

Remove an ongoing listener for EnergyLevel information.

abstract void

Remove an ongoing listener for EvStatus information.

abstract void

Remove an ongoing listener for Mileage information.

abstract void

Remove an ongoing listener for Speed information.

abstract void

Remove an ongoing listener for TollCard information.

Public methods

addEnergyLevelListener

Added in 1.1.0
abstract void addEnergyLevelListener(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<EnergyLevel> listener
)

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
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<EnergyLevel> listener

the listener that will be invoked when data is available

addEvStatusListener

Added in 1.2.0
@ExperimentalCarApi
abstract void addEvStatusListener(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<EvStatus> listener
)

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
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<EvStatus> listener

the listener that will be invoked when data is available

addMileageListener

Added in 1.1.0
abstract void addMileageListener(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<Mileage> listener
)

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
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<Mileage> listener

the listener that will be invoked when data is available

addSpeedListener

Added in 1.1.0
abstract void addSpeedListener(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<Speed> listener
)

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
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<Speed> listener

the listener that will be invoked when data is available

addTollListener

Added in 1.1.0
abstract void addTollListener(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<TollCard> listener
)

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
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<TollCard> listener

the listener that will be invoked when data is available

fetchEnergyProfile

Added in 1.1.0
abstract void fetchEnergyProfile(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<EnergyProfile> listener
)

Reguest the EnergyProfile information about the car hardware.

Parameters
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<EnergyProfile> listener

the listener that will be invoked when data is available

fetchExteriorDimensions

Added in 1.7.0-beta02
@RequiresCarApi(value = 7)
default void fetchExteriorDimensions(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<ExteriorDimensions> listener
)

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
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<ExteriorDimensions> listener

the listener that will be invoked when data is available

fetchModel

Added in 1.1.0
abstract void fetchModel(
    @NonNull Executor executor,
    @NonNull OnCarDataAvailableListener<Model> listener
)

Fetch the Model information about the car hardware.

Parameters
@NonNull Executor executor

the executor which will be used for invoking the listener

@NonNull OnCarDataAvailableListener<Model> listener

the listener that will be invoked when data is available

removeEnergyLevelListener

Added in 1.1.0
abstract void removeEnergyLevelListener(
    @NonNull OnCarDataAvailableListener<EnergyLevel> listener
)

Remove an ongoing listener for EnergyLevel information.

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

Parameters
@NonNull OnCarDataAvailableListener<EnergyLevel> listener

the listener to remove

removeEvStatusListener

Added in 1.2.0
@ExperimentalCarApi
abstract void removeEvStatusListener(
    @NonNull OnCarDataAvailableListener<EvStatus> listener
)

Remove an ongoing listener for EvStatus information.

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

Parameters
@NonNull OnCarDataAvailableListener<EvStatus> listener

the listener to remove

removeMileageListener

Added in 1.1.0
abstract void removeMileageListener(
    @NonNull OnCarDataAvailableListener<Mileage> listener
)

Remove an ongoing listener for Mileage information.

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

Parameters
@NonNull OnCarDataAvailableListener<Mileage> listener

the listener to remove

removeSpeedListener

Added in 1.1.0
abstract void removeSpeedListener(@NonNull OnCarDataAvailableListener<Speed> listener)

Remove an ongoing listener for Speed information.

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

Parameters
@NonNull OnCarDataAvailableListener<Speed> listener

the listener to remove

removeTollListener

Added in 1.1.0
abstract void removeTollListener(
    @NonNull OnCarDataAvailableListener<TollCard> listener
)

Remove an ongoing listener for TollCard information.

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

Parameters
@NonNull OnCarDataAvailableListener<TollCard> listener

the listener to remove