Delphi Android API 26 FileURIExposed

时间:2019-01-15 09:02:46

标签: android delphi firemonkey photo

早上好, 因此我成功将delphi App升级到API 26(我目前正在使用Rad Studio 10.1 Berlin),一切正常,除了在Android 6+设备上拍照外,我收到以下错误消息:

Error

我的代码:

procedure TF_SS_MAIN.ListBoxItem_menu_pictureClick(Sender: TObject);
var
  Service: IFMXCameraService;
  Params: TParamsPhotoQuery;
begin
  {$IFDEF Android}
  if TOSVersion.Check(6, 0) then
  begin
    try
      //Android 6+ stuff goes here, if basically I put the same code down below it crashes
    except
      on E: Exception do
        ShowMessage(E.Message);
    end;
  end
  else
  {$ENDIF}
  if TPlatformServices.Current.SupportsPlatformService(IFMXCameraService, Service) then
  begin
    Params.Editable := true;
    // Specifies whether to save a picture to device Photo Library
    Params.NeedSaveToAlbum := false;
    // Params.RequiredResolution := TSize.Create(2736, 4864);
    Params.RequiredResolution := TSize.Create(2500, 2500);
    // Params.
    Params.OnDidFinishTaking := DoDidFinish;

    Service.TakePhoto(nil, Params);

    TabItem_picture.Visible := true;
    TabControl.ActiveTab := TabItem_picture;
  end
  else
    ShowMessage('This device does not support the camera service');
end;

1 个答案:

答案 0 :(得分:1)

在柏林的10.1中似乎没有办法,我尝试了外部URi,但是它没有用,所以这种情况下最好的情况是使用Remy Lebeau的建议并获得专门针对API 26的10.3 Rio更新+