CameraUnavailableException

public class CameraUnavailableException
extends Exception

java.lang.Object
   ↳ java.lang.Throwable
     ↳ java.lang.Exception
       ↳ androidx.camera.core.CameraUnavailableException


CameraUnavailableException is thrown when a camera device could not be queried or opened or if the connection to an opened camera device is no longer valid.

Summary

Constants

int CAMERA_DISABLED

The camera is disabled due to a device policy, and cannot be opened.

int CAMERA_DISCONNECTED

The camera device is removable and has been disconnected from the Android device, or the camera service has shut down the connection due to a higher-priority access request for the camera device.

int CAMERA_ERROR

The camera device is currently in the error state.

int CAMERA_IN_USE

The camera device is in use already.

int CAMERA_MAX_IN_USE

The system-wide limit for number of open cameras or camera resources has been reached, and more camera devices cannot be opened.

int CAMERA_UNAVAILABLE_DO_NOT_DISTURB

The camera is unavailable due to NotificationManager.Policy.

int CAMERA_UNKNOWN_ERROR

Some other error occurred.

Public constructors

CameraUnavailableException(int reason)
CameraUnavailableException(int reason, String message)
CameraUnavailableException(int reason, String message, Throwable cause)
CameraUnavailableException(int reason, Throwable cause)

Public methods

int getReason()

The reason the camera is unavailable.

Inherited methods

Constants

CAMERA_DISABLED

public static final int CAMERA_DISABLED

The camera is disabled due to a device policy, and cannot be opened.

Constant Value: 1 (0x00000001)

CAMERA_DISCONNECTED

public static final int CAMERA_DISCONNECTED

The camera device is removable and has been disconnected from the Android device, or the camera service has shut down the connection due to a higher-priority access request for the camera device.

Constant Value: 2 (0x00000002)

CAMERA_ERROR

public static final int CAMERA_ERROR

The camera device is currently in the error state.

The camera has failed to open or has failed at a later time as a result of some non-user interaction.

Constant Value: 3 (0x00000003)

CAMERA_IN_USE

public static final int CAMERA_IN_USE

The camera device is in use already.

Constant Value: 4 (0x00000004)

CAMERA_MAX_IN_USE

public static final int CAMERA_MAX_IN_USE

The system-wide limit for number of open cameras or camera resources has been reached, and more camera devices cannot be opened.

Constant Value: 5 (0x00000005)

CAMERA_UNAVAILABLE_DO_NOT_DISTURB

public static final int CAMERA_UNAVAILABLE_DO_NOT_DISTURB

The camera is unavailable due to NotificationManager.Policy. Some API 28 devices cannot access the camera when the device is in "Do Not Disturb" mode. The camera will not be accessible until "Do Not Disturb" mode is disabled.

Constant Value: 6 (0x00000006)

CAMERA_UNKNOWN_ERROR

public static final int CAMERA_UNKNOWN_ERROR

Some other error occurred.

Constant Value: 0 (0x00000000)

Public constructors

CameraUnavailableException

public CameraUnavailableException (int reason)

Parameters
reason int

CameraUnavailableException

public CameraUnavailableException (int reason, 
                String message)

Parameters
reason int

message String

CameraUnavailableException

public CameraUnavailableException (int reason, 
                String message, 
                Throwable cause)

Parameters
reason int

message String

cause Throwable

CameraUnavailableException

public CameraUnavailableException (int reason, 
                Throwable cause)

Parameters
reason int

cause Throwable

Public methods

getReason

public int getReason ()

The reason the camera is unavailable.

Returns
int