views:

78

answers:

1

Would it be possible to control/interface with an Android phone through USB in a WinForm application? Is there any library for that, without using any original Android tool (ADB, fastboot)?

+1  A: 

The only USB support in Android is for adb and USB mass storage. Neither let you talk to on-device applications. Both let you access files on the SD card. adb may provide additional features, but you cannot access "installed apps, contacts, messages". None of this is designed to work from C#, though you can call out to the adb command-line executable if you wish.

A network-based protocol would be easiest, for a subset of your goals. A Bluetooth protocol may be doable for the same subset.

CommonsWare
I saw a few applications written in C# what could do this, but unfortunately they weren't opensource or weren't complete. As an example, Android Manager (what is deceased and only has a preview, the beta executable got lost).
fonix232
Basically what I want is an ADB port in C#. So to communicate with the phone, ask for specified data, and so on. But looks like noone made such a thing yet.
fonix232
Well the source for adb is hidden somewhere in here, I looked for a while but couldn't find it right away. http://android.git.kernel.org/ for a port. Also, its still open source so you could just include adb.exe in your application package and make system calls to it to do your bidding. The user won't need the android SDK installed just the drivers
schwiz
Yes I could make the call, but still a C# binding/total port would be very nice and a lot more useful, as there would be no need for executables, just one, the WinForm app itself. Also, I have the source, but it is pretty complicated :S
fonix232
@fonix232: "Basically what I want is an ADB port in C#." -- `adb` does not let you access "installed apps, contacts, messages".
CommonsWare
In a tricky way, it does ;)It lets you access the so called Terminal - where you can do anything. Call a list of installed applications - easy, just listing files in a given directory/directories, and gathering some data about it. Messages/Contacts - all stored in specific files. Just cat them and got them all. What do you think those Message/Contact/Application managers are built upon?
fonix232
@fonix232: You cannot use `adb shell` to access anything of what you have described here on a regular production device. You most certainly cannot "do anything". This would be trivial for you to test with your own non-rooted Android phone.
CommonsWare