How to transfer a file(db) from Android to PC using Delphi(Firemonkey)

Asked

Viewed 164 times

2

I am using Delphi Tokyo 10.2.3 for Android programming, Firemonkey deputy (FMX), I need to create a code that is possible inside the App on android can transfer a file in case the Database to the PC via USB, without using internet that is the purpose.

I tried to use Shellexecute but android is android and Windows is windows that became apparent, Winexec also.

Intent would not work because it is more used by Fileprovider in URL and URI

I’m aware that ADB (Android Debug Bridge) can be used to do this via CMD, but I don’t know how to do it, I’ve tried using Java plugins but it seems that in Delphi Tokyo or FMX itself is incompatible with some classes of Android Object Pascal Wrapper( FMX Express Android SDK’s library compiled for java to pas).

Following code I thought if I use cmd with ADB :

procedure TfrmSync.lblUsbClick(Sender: TObject);
var
   command : string;
   val     : TValidate;
begin
    val := TValidate.Create;
    Command := 'C:\Users\Geovani\AppData\Local\Android\Sdk\platform-tools\adb.exe pull '+TPath.Combine(TPath.GetDocumentsPath, 'pedidos.db')+' '+'C:\Users\Geovani\Desktop\Gi\TESTE BANCO';
    val.USB(Command);
end;

A Procedure USB(Cmd) for now has nothing relevant because I do not know how to do it, I have no idea and I searched a lot I only think via Socket by Clientside and Serverside, which would be impossible for me because I was looking for Offline and simple as a transfer.

Thank you in advance!

  • Hello! First there are some gaps that need to be answered. 1) Where will the application be (Windows, Android)? 2) When a USB connection occurs, if allowed through Android will naturally be generated a "drive", example "E:", "F:" or any other letter available, in Windows. And this is your case, I think it would be the best way for you to transfer information between systems.

    1. Android , 2) But vc says this in principle to use the ADB or the same CMD/DOS commands themselves ?
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.