Search code examples
androidloggingadb

Push files from Android to PC over ADB


It's probably not possible due to safety issues and many other reasons, but it's worth a shot, so here goes:

Is it possible to push files from an Android device directly to a computer using ADB?

Why would you want that, you might ask. Good question. I find it useful to view larger Strings on a computer instead of on an Android device, especially since Log.d() won't show Strings of a length more of a couple hundred characters. Things like SOAP requests and responses, other xml files are not easily viewable on my Nexus 7. I've tried some things with the UsbManager class and the UsbDevice class, but I can't seem to find the USB-connection to my computer.

PS. I can think of other methods, like using a logging webservice, for all I care, or writing a script which pulls a certain (log) directory periodically, but I'm just curious whether or not it is possible, it makes my life ever so slightly easier.


Solution

  • As I can read in your question, you are quite aware of the fact that you can pull files from your Android device to your PC, so I won't suggest that.

    To answer your question: No, this is not possible. It's not how adb works. Even if you could "push" from Android to PC, you need a piece of software to handle the data. Android does not contain any API which makes that possible, and neither does any part of the Android SDK.

    Still you could use any of the methods you already know of (adb pull, Eclipse DDMS View, and yes, even a logging webservice, as you yourself suggested).

    Hope this clarifies a bit.