delphi 11 中的相机权限
Camera permission in delphi 11
我试图通过 android 设备的摄像头获取图像,使用 actionList,我总是得到以下错误。
我哪里错了?
这是我的代码:
procedure TMain.BtnTakePhotoClick(Sender: TObject);
var
Service: IFMXCameraService;
Params : TParamsPhotoQuery;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXCameraService,Service) then
begin
Params.Editable := True;
// Specifies whether to save a picture to device Photo Library
Params.NeedSaveToAlbum := True;
Params.RequiredResolution := TSize.Create(640, 640);
Params.OnDidFinishTaking := TakePhotoFromCameraAction1DidFinishTaking;
Service.TakePhoto(BtnTakePhoto, Params);
end
else
ShowMessage('This device does not support the camera service');
end;
OnformCreate Permission:
procedure TMain.FormCreate(Sender: TObject);
var
VCam, VRead, VWrite: string;
begin
// Request permissions
VCam := JStringToString(TJManifest_permission.JavaClass.CAMERA);
VRead := JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE);
VWrite := JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE);
PermissionsService.RequestPermissions([VCam, VRead, VWrite], PermissionRequestResult, DisplayRationale);
end;
I always receive: There is no overloaded version of 'RequestPermission'.
Waht i'm doing wrong?
Thank you.
你可能用过旧的声明,这样就好了:
PROCEDURE PermissionRequestResult( Sender : TObject;
const APermissions : TClassicStringDynArray;
const AGrantResults : TClassicPermissionStatusDynArray);
PROCEDURE DisplayRationale( Sender : TObject;
const APermissions : TClassicStringDynArray;
const APostRationaleProc : TProc);
我试图通过 android 设备的摄像头获取图像,使用 actionList,我总是得到以下错误。 我哪里错了?
这是我的代码:
procedure TMain.BtnTakePhotoClick(Sender: TObject);
var
Service: IFMXCameraService;
Params : TParamsPhotoQuery;
begin
if TPlatformServices.Current.SupportsPlatformService(IFMXCameraService,Service) then
begin
Params.Editable := True;
// Specifies whether to save a picture to device Photo Library
Params.NeedSaveToAlbum := True;
Params.RequiredResolution := TSize.Create(640, 640);
Params.OnDidFinishTaking := TakePhotoFromCameraAction1DidFinishTaking;
Service.TakePhoto(BtnTakePhoto, Params);
end
else
ShowMessage('This device does not support the camera service');
end;
OnformCreate Permission:
procedure TMain.FormCreate(Sender: TObject);
var
VCam, VRead, VWrite: string;
begin
// Request permissions
VCam := JStringToString(TJManifest_permission.JavaClass.CAMERA);
VRead := JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE);
VWrite := JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE);
PermissionsService.RequestPermissions([VCam, VRead, VWrite], PermissionRequestResult, DisplayRationale);
end;
I always receive: There is no overloaded version of 'RequestPermission'.
Waht i'm doing wrong?
Thank you.
你可能用过旧的声明,这样就好了:
PROCEDURE PermissionRequestResult( Sender : TObject;
const APermissions : TClassicStringDynArray;
const AGrantResults : TClassicPermissionStatusDynArray);
PROCEDURE DisplayRationale( Sender : TObject;
const APermissions : TClassicStringDynArray;
const APostRationaleProc : TProc);