How create application in delphi which send, receive and install files to android device connected via USB?

StackOverflow https://stackoverflow.com/questions/20988958

Question

I want to create application in Delphi which communicate with USB connected android device.

This application have to following features:

  • Displays the list of connected devices.
  • Send and Receive any file From/To device.
  • Install APK file on device directly from PC.

Yes, it's sound like use of Android Debug Bridge(ADB). But how to use ADB or any other method to achieve this functionality.

Edit: I tried adb.exe with shellExecute.

strParameter := '/c "C:\Program Files\android-sdk\platform-tools\adb" push "' +
                  strLocalFile + '" ' + strRemotePath + ' > c:/out.txt';
ShellExecute(0,           // Handle
     'open',              // Operation
     PChar('cmd.exe'),    // File Name
     PChar(strParameter), // Parameters
     PChar(ExtractFilePath('cmd.exe')),// Directory
     SW_HIDE)) > 32 then begin         // Show Cmd
        ShowMessage('Success..');
     end;

But not getting proper output and file not goes to destination. Please tell me any other method.

Was it helpful?

Solution

Finally, i found one method to do this from another question: https://stackoverflow.com/questions/2015388/how-to-send-command-to-console-application-from-gui-application?rq=1

This method describes how to send command to console application. We have ADB.EXE and following command to do:

adb devices - to list out connected devices

adb push sourceFilePath destinationFilePath - to send source file to destination device.

adb pull sourceFilePath destinationFilePath - to receive source file[on Device] to destination [on PC].

adb install apkFilePath - to Install file on Device

More ADB Command can be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top