美好的一天,所以我成功地将我的delphi应用程序升级到API 26(我目前正在使用Rad Studio 10.1柏林)一切正常,除了在Android 6+设备上拍照,我收到以下错误:
我的代码:
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;
似乎没有办法在10.1柏林做到这一点,我尝试了外部URi,但它不起作用,因此最好的情况是使用Remy Lebeau的建议并获得专门针对API 26+的10.3 Rio更新