Sdílet prostřednictvím


CameraManager.OpenCamera Method

Definition

Overloads

OpenCamera(String, CameraDevice+StateCallback, Handler)

Open a connection to a camera with the given ID.

OpenCamera(String, IExecutor, CameraDevice+StateCallback)

OpenCamera(String, CameraDevice+StateCallback, Handler)

Open a connection to a camera with the given ID.

[Android.Runtime.Register("openCamera", "(Ljava/lang/String;Landroid/hardware/camera2/CameraDevice$StateCallback;Landroid/os/Handler;)V", "")]
[Android.Runtime.RequiresPermission("android.permission.CAMERA")]
public void OpenCamera (string cameraId, Android.Hardware.Camera2.CameraDevice.StateCallback callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("openCamera", "(Ljava/lang/String;Landroid/hardware/camera2/CameraDevice$StateCallback;Landroid/os/Handler;)V", "")>]
[<Android.Runtime.RequiresPermission("android.permission.CAMERA")>]
member this.OpenCamera : string * Android.Hardware.Camera2.CameraDevice.StateCallback * Android.OS.Handler -> unit

Parameters

cameraId
String

The unique identifier of the camera device to open

callback
CameraDevice.StateCallback

The callback which is invoked once the camera is opened

handler
Handler

The handler on which the callback should be invoked, or null to use the current thread's Looper.

Attributes

Exceptions

if the camera is disabled by device policy, has been disconnected, or is being used by a higher-priority camera API client.

if cameraId or the callback was null, or the cameraId does not match any currently or previously available camera device.

if the application does not have permission to access the camera

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • GetCameraIdList()
  • <xref:Android.App.Admin.DevicePolicyManager.SetCameraDisabled(Android.Content.ComponentName%2c+System.Boolean)>

Applies to

OpenCamera(String, IExecutor, CameraDevice+StateCallback)

[Android.Runtime.Register("openCamera", "(Ljava/lang/String;Ljava/util/concurrent/Executor;Landroid/hardware/camera2/CameraDevice$StateCallback;)V", "", ApiSince=28)]
[Android.Runtime.RequiresPermission("android.permission.CAMERA")]
public void OpenCamera (string cameraId, Java.Util.Concurrent.IExecutor executor, Android.Hardware.Camera2.CameraDevice.StateCallback callback);
[<Android.Runtime.Register("openCamera", "(Ljava/lang/String;Ljava/util/concurrent/Executor;Landroid/hardware/camera2/CameraDevice$StateCallback;)V", "", ApiSince=28)>]
[<Android.Runtime.RequiresPermission("android.permission.CAMERA")>]
member this.OpenCamera : string * Java.Util.Concurrent.IExecutor * Android.Hardware.Camera2.CameraDevice.StateCallback -> unit

Parameters

cameraId
String
executor
IExecutor
Attributes

Applies to