public void GoToPermissionSettings() { if (NativeCamera.CanOpenSettings()) { NativeCamera.OpenSettings(); } }
/// <summary> /// 打开相机录像 /// </summary> public static void OpenCameraVideo(Action <string> callBack) { NativeCamera.Permission permission = NativeCamera.RecordVideo((string path) => { if (!string.IsNullOrEmpty(path) && callBack != null) { callBack(path); } }); if (permission != NativeCamera.Permission.Granted) { ShowToast("当前没有相机访问权限,请在设置中打开"); //打开应用程序设置 if (NativeCamera.CanOpenSettings()) { NativeCamera.OpenSettings(); } } }
/// <summary> /// 打开相机拍照 /// </summary> public static void OpenCamera(Action <Texture2D> callBack) { NativeCamera.Permission permission = NativeCamera.TakePicture((string path) => { if (!string.IsNullOrEmpty(path) && callBack != null) { callBack(NativeCamera.LoadImageAtPath(path)); } }); if (permission != NativeCamera.Permission.Granted) { ShowToast("当前没有相机访问权限,请在设置中打开"); //打开应用程序设置 if (NativeCamera.CanOpenSettings()) { NativeCamera.OpenSettings(); } } }
public void PedirImagen() { var permiso = NativeCamera.TakePicture(path => { if (!string.IsNullOrEmpty(path)) { if (imagenRecuperada) { Destroy(imagenRecuperada); } imagenRecuperada = NativeCamera.LoadImageAtPath(path, -1, false, false); alAbrirTextura.Invoke(imagenRecuperada); } }); if (permiso == NativeCamera.Permission.ShouldAsk) { if (NativeCamera.CanOpenSettings()) { NativeCamera.OpenSettings(); } } }