- cameraId
- The unique identifier of the camera device to open
- callback
- The callback which is invoked once the camera is opened
- handler
- The handler on which the callback should be invoked, or null to use the current thread's Android.OS.Looper.
Type Reason Android.Hardware.Camera2.CameraAccessException if the camera is disabled by device policy, or the camera has become or was disconnected. Java.Lang.IllegalArgumentException if cameraId or the callback was null, or the cameraId does not match any currently or previously available camera device. Java.Lang.SecurityException if the application does not have permission to access the camera
Open a connection to a camera with the given ID.
Use CameraManager.GetCameraIdList to get the list of available camera devices. Note that even if an id is listed, open may fail if the device is disconnected between the calls to CameraManager.GetCameraIdList and CameraManager.OpenCamera(string, .StateCallback, .StateCallback).
Once the camera is successfully opened, NoType:android/hardware/camera2/CameraDevice$StateCallback;Href=../../../../reference/android/hardware/camera2/CameraDevice.StateCallback.html#onOpened(android.hardware.camera2.CameraDevice) will be invoked with the newly opened Android.Hardware.Camera2.CameraDevice. The camera device can then be set up for operation by calling CameraDevice.createCaptureSession(java.util.List<android.view.Surface>, android.hardware.camera2.CameraCaptureSession.StateCallback, android.os.Handler) and CameraDevice.CreateCaptureRequest(CameraTemplate)
If the camera becomes disconnected during initialization after this function call returns, NoType:android/hardware/camera2/CameraDevice$StateCallback;Href=../../../../reference/android/hardware/camera2/CameraDevice.StateCallback.html#onDisconnected(android.hardware.camera2.CameraDevice) with a Android.Hardware.Camera2.CameraDevice in the disconnected state (and NoType:android/hardware/camera2/CameraDevice$StateCallback;Href=../../../../reference/android/hardware/camera2/CameraDevice.StateCallback.html#onOpened(android.hardware.camera2.CameraDevice) will be skipped).
If opening the camera device fails, then the device callback's NoType:android/hardware/camera2/CameraDevice$StateCallback;Href=../../../../reference/android/hardware/camera2/CameraDevice.StateCallback.html#onError(android.hardware.camera2.CameraDevice, int) method will be called, and subsequent calls on the camera device will throw a Android.Hardware.Camera2.CameraAccessException.