1. Permission 선택
2. Permission 코딩 하기
uses
System.Permissions;
var
_PermissionReadExternalStorage: string;
_PermissionWriteExternalStorage: string;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
{$IFDEF ANDROID}
_PermissionReadExternalStorage :=
JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE);
_PermissionWriteExternalStorage :=
JStringToString(TJManifest_permission.JavaClass.Write_EXTERNAL_STORAGE);
{$ENDIF}
end;
procedure TfrmMain.FormShow(Sender: TObject);
begin
PermissionsService.RequestPermissions(
[_PermissionReadExternalStorage, _PermissionWriteExternalStorage],
procedure(const APermissions: TArray<string>;
const AGrantResults: TArray<TPermissionStatus>)
begin
if (Length(AGrantResults) >= 2) and
(AGrantResults[0] = TPermissionStatus.Granted) and
(AGrantResults[1] = TPermissionStatus.Granted) then
begin
// do something
end
else
TDialogService.ShowMessage('external storage permission not assigned!');
end,
procedure(const APermissions: TArray<string>;
const APostRationaleProc: TProc)
begin
TDialogService.ShowMessage('external storage premission required!',
procedure(const AResult: TModalResult)
begin
APostRationaleProc;
end)
end);
end;