Delphi Android API 26 FileURIExposed

Viewed 527

Good day, so I succesfully upgraded my delphi App to API 26 (I'm currently using Rad Studio 10.1 Berlin) everything works, except taking a photo on Android 6+ devices, I get the following error:

Error

And my code:

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 Answers

It seems that there's no way of doing it in 10.1 Berlin, I tried the external URi's but It doesn't work, so the best case in scenario is to use Remy Lebeau's advice and get the 10.3 Rio update specifically targeting API 26+

Related