Delphi FMX - Android API 26 - SQLite DB Connection with UniDAC

1.2k Views Asked by At

I'm using Tokyo 10.2.3 and UniDAC component for interacting with an SQLite database on Android API 26 Platform. So far, with the help from Dave:

http://www.delphiworlds.com/2018/06/targeting-android-8-and-higher-continued/

... the App worked fine with access to 'TakePhoto', 'Positioning', 'W/R to external storage' ... The UniDAC MySQL Connection is working too but seems to need no further permissions.

But I can get no connection to my SQLite Database anymore. Before the change from SDK14 to SDK26, the connection worked fine. Seems to me, as it is a problem with accessing 'external' URIs as Dave described in his blog. I changed the Manifest.xml, added a file-provider and added the provider_paths.xml too.

The way of choose the Databasefile with UniDAC as String:

SQLiteConnection1.Database := TPath.Combine(TPath.GetDocumentsPath, 'test.db');

Any solutions or help outside?

1

There are 1 best solutions below

0
On

Deployment path: assets\internal
Change UniConnection.Direct to true. Add UNIDAC before connection

procedure TDataModule1.UniCon_SQliteBeforeConnect(Sender: TObject);
begin
  {$IF DEFINED(iOS) or DEFINED(ANDROID)}
  DataModule1.UniCon_SQlite.Database :=
  TPath.Combine(TPath.GetDocumentsPath, 'st_pass.db');
  {$ENDIF}
end;