Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

CameraManager.AvailabilityCallback

public static abstract class CameraManager.AvailabilityCallback
extends Object

java.lang.Object
   ↳ android.hardware.camera2.CameraManager.AvailabilityCallback


A callback for camera devices becoming available or unavailable to open.

Cameras become available when they are no longer in use, or when a new removable camera is connected. They become unavailable when some application or service starts using a camera, or when a removable camera is disconnected.

Extend this callback and pass an instance of the subclass to CameraManager#registerAvailabilityCallback to be notified of such availability changes.

Summary

Public constructors

CameraManager.AvailabilityCallback()

Public methods

void onCameraAvailable(String cameraId)

A new camera has become available to use.

void onCameraUnavailable(String cameraId)

A previously-available camera has become unavailable for use.

Inherited methods

Public constructors

CameraManager.AvailabilityCallback

public CameraManager.AvailabilityCallback ()

Public methods

onCameraAvailable

Added in API level 21
public void onCameraAvailable (String cameraId)

A new camera has become available to use.

The default implementation of this method does nothing.

Parameters
cameraId String: The unique identifier of the new camera. This value must never be null.

onCameraUnavailable

Added in API level 21
public void onCameraUnavailable (String cameraId)

A previously-available camera has become unavailable for use.

If an application had an active CameraDevice instance for the now-disconnected camera, that application will receive a CameraDevice.StateCallback#onDisconnected.

The default implementation of this method does nothing.

Parameters
cameraId String: The unique identifier of the disconnected camera. This value must never be null.