CarRemoteAccessManager

public final class CarRemoteAccessManager
extends Object

java.lang.Object
   ↳ android.car.remoteaccess.CarRemoteAccessManager


CarRemoteAccessManager allows applications to listen to remote task requests even while Android System is not running.

The remote task client registers to CarRemoteAccessManager to listen to remote access events. At RemoteTaskClientCallback#onRegistrationUpdated it is required to share serviceId, deviceId and clientId with the cloud service which will use the IDs to wake the vehicle. At RemoteTaskClientCallback#onRemoteTaskRequested, it starts executing the given task. It is supposed to call reportRemoteTaskDone(java.lang.String) when it finishes the given task. Once the task completion is reported or the timeout expires, Android System goes back to either the previous power state or the specified power state.

Summary

Nested classes

interface CarRemoteAccessManager.CompletableRemoteTaskFuture

An interface passed from RemoteTaskClientCallback

interface CarRemoteAccessManager.RemoteTaskClientCallback

Listener for remote task events. 

Public methods

void clearRemoteTaskClient()

Clears the remote task client previously set via setRemoteTaskClient(java.util.concurrent.Executor, android.car.remoteaccess.CarRemoteAccessManager.RemoteTaskClientCallback).

void reportRemoteTaskDone(String taskId)

Reports that remote tast execution is completed, so that the vehicle will go back to the power state before the wake-up.

void setRemoteTaskClient(Executor executor, CarRemoteAccessManager.RemoteTaskClientCallback callback)

Sets the remote task client represented as RemoteTaskClientCallback.

Inherited methods

Public methods

clearRemoteTaskClient

Added in API level 34
public void clearRemoteTaskClient ()

Clears the remote task client previously set via setRemoteTaskClient(java.util.concurrent.Executor, android.car.remoteaccess.CarRemoteAccessManager.RemoteTaskClientCallback).

After the remote task client is cleared, all tasks associated with the previous client will not be delivered and the client must not call reportRemoteTaskDone with the task ID associated with the previous client ID.
Requires Car.PERMISSION_USE_REMOTE_ACCESS

Throws
IllegalStateException if callback is not registered.

reportRemoteTaskDone

Added in API level 34
public void reportRemoteTaskDone (String taskId)

Reports that remote tast execution is completed, so that the vehicle will go back to the power state before the wake-up.
Requires Car.PERMISSION_USE_REMOTE_ACCESS

Parameters
taskId String: ID of the remote task which has been completed.

Throws
IllegalArgumentException If taskId is null.
IllegalStateException If the remote task client is not registered or not woken up.

setRemoteTaskClient

Added in API level 34
public void setRemoteTaskClient (Executor executor, 
                CarRemoteAccessManager.RemoteTaskClientCallback callback)

Sets the remote task client represented as RemoteTaskClientCallback.
Requires Car.PERMISSION_USE_REMOTE_ACCESS

Parameters
executor Executor: Executor on which callback is executed.

callback CarRemoteAccessManager.RemoteTaskClientCallback: RemoteTaskClientCallback that listens to remote task events.

Throws
IllegalStateException When a remote task client is already set.
IllegalArgumentException When the given callback or the executor is null.