Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

transfer files from android to computer via usb programmatically

Tags:

android

adb

usb

I am looking for a solution which uses Android API to transfer a text file from an Android powered device to a computer through USB cable. I have found USB host but I cannot use this because the computer can not act as a device for the Android host.

Do you have any suggestions how I can achieve this?

like image 746
niculare Avatar asked Apr 03 '13 18:04

niculare


People also ask

Which app is best for File Transfer between Android and PC?

AirDroid Personal is a must-have program for everyone looking for the simplest and smoothest way to wireless share or transfer data from one device to another. AirDroid, unlike other programs, also allows you to check and respond to phone notifications from your computer.

Why I Cannot transfer files from Android to PC?

Possible Reasons File Transfer is disabled on your Android phone or tablet. The USB cable you're using to connect both devices is damaged or malfunctioning. Similarly, it can be an issue with the USB port on your Mac. So, try using another port or change the cable to confirm.


1 Answers

I have solved this problem by using adb status-window to continuously check for device status, and when a new device is connected, the required files are transferred to the computer using adb pull command.

In order to achieve a portable solution (i.e. to run independently of Android platform), I just copied the files 'adb.exe' and 'AdbWinApi.dll' into my application and used the adb from there.

like image 120
niculare Avatar answered Nov 12 '22 20:11

niculare