CameraUnavailableException

open class CameraUnavailableException : Exception
kotlin.Any
   ↳ kotlin.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
static Int

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

static Int

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.

static Int

The camera device is currently in the error state.

static Int

The camera device is in use already.

static Int

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

static Int

The camera is unavailable due to NotificationManager.Policy.

static Int

Some other error occurred.

Public constructors
<init>(reason: Int)

<init>(reason: Int, @Nullable message: String?)

<init>(reason: Int, @Nullable message: String?, @Nullable cause: Throwable?)

<init>(reason: Int, @Nullable cause: Throwable?)

Public methods
open Int

The reason the camera is unavailable.

Constants

CAMERA_DISABLED

static val CAMERA_DISABLED: Int

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

Value: 1

CAMERA_DISCONNECTED

static val CAMERA_DISCONNECTED: Int

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.

Value: 2

CAMERA_ERROR

static val CAMERA_ERROR: Int

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.

Value: 3

CAMERA_IN_USE

static val CAMERA_IN_USE: Int

The camera device is in use already.

Value: 4

CAMERA_MAX_IN_USE

static val CAMERA_MAX_IN_USE: Int

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

Value: 5

CAMERA_UNAVAILABLE_DO_NOT_DISTURB

static val CAMERA_UNAVAILABLE_DO_NOT_DISTURB: Int

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.

Value: 6

CAMERA_UNKNOWN_ERROR

static val CAMERA_UNKNOWN_ERROR: Int

Some other error occurred.

Value: 0

Public constructors

<init>

CameraUnavailableException(reason: Int)

<init>

CameraUnavailableException(
    reason: Int,
    @Nullable message: String?)

<init>

CameraUnavailableException(
    reason: Int,
    @Nullable message: String?,
    @Nullable cause: Throwable?)

<init>

CameraUnavailableException(
    reason: Int,
    @Nullable cause: Throwable?)

Public methods

getReason

open fun getReason(): Int

The reason the camera is unavailable.