Android development setup when using USB Host mode - android

I am a relatively new Android developer but have gotten pretty familiar with the SDK, using LogCat, etc. However, I'm now working on an app (for a Galaxy Tab 7-plus) that utilizes USB Host mode to talk to an external USB device and I've run into an issue.
My question is: What is an ideal environmental setup that will allow me to take advantage of all of the SDK tools (adb, debug, LogCat, DDMS, and so forth) when I am unable to be connected to my PC via USB (since the external USB device my tablet is talking to is using my tab's only USB port)?
Is there an emulator available somewhere (I've searched in vain) that will allow me to simulate USB Host mode using a USB port on my PC?
Do I need to go to some type of on-board logging app?
Is there some kind of 30-pin splitter available so I can connect to both the external device and my PC? (I'm guessing this is impossible, but I'm a hardware idiot... in addition to a run-of-the-mill idiot).
Thanks in advance for your help!
-KR

As I posted in the comments, If the tablet is rooted you can use AdbWireless (Application on the Market)

This can also be done without rooting. Google/Android officially supports this, as described at the bottom of this page:
http://developer.android.com/guide/topics/usb/index.html
But AdbWireless is easier if you are rooted.

Related

Can android be the host to a USB device?

I have a USB device and want to build a nice graphical interface for it. Is it possible to connect the USB device to Android, have Android be the host, and communicate with it and build a UI? If so, which libraries would allow me to do this? And if not, what alternative workarounds are there? I would prefer a wired connection for reliability.
It's possible. I have personally used an USBc to USB cable to hook up everything from a keyboard and mouse to an external monitor. Some phones/devices may not have a data port on the external USB port or the chips needed for external monitors but android itself has USB drivers built in.
I think this question remained unanswered for so long because it's so easy to google the android developer page that should answer your question in specifics here. It's the developer guide for using android as a USB host.

How to debug application on real device by using WIFI while not being able to use cable at all

My MacBook computer battery is broken and somehow it has not enough power to power device by usb-c adapter so I cannot connect anything and only have to use android emulator. But I need to debug on real device while testing some ocr sdk that obviously don't want to recognize anything in android emulator virtual scene. I asked other question about that but still I am puzzled by this inability to use WIFI for usb debugging because sdk runs fine on my phone but to debug using fabric and APK deployment is really horrible dev experience and productivity.
Is there some way I can setup WIFI debugging without cable at all... Maybe I need to root my device but again how to do it without cable, it seems impossible either way. I feel in like in dead and but still asking question here. I have computer and phone but cannot connect them for debugging by wifi.
Afraid I don't have an easy wireless solution. The closest thing I could find is that android wearables may have a debug over bluetooth feature, but it's built to route through another (wired) android device.
There is likely a feasible wired solution though- you can hook the device to a powered hub and the hub to the computer.
You could also use an adapter of sorts. They were built for printers and such before everything came with wifi and could get a proper wireless setup going without either side realizing they aren't directly connected over USB (OS still knows that some funky usb drivers are loaded and a separate application may need to run to connect), but again more hardware. A decent Wireless "USB Device Server" seems to run ~$100 while wired ones are cheaper, but not as cheap as a powered usb hub.
If you have another machine, you can use it to enable wireless debugging on your Android phone. See https://developer.android.com/studio/command-line/adb#wireless. Once wireless debugging is enabled, you can connect to it from your Mac without using USB. You still need USB for enabling wireless debugging though, but you can do it from a different machine. This should work on all Android phones, root is not required.
Update [2021]:
Things have developed since this question was asked. WiFi Debugging is a first class option now on newer devices. See https://developer.android.com/studio/run/device.html#wireless for details.

I'm interested in using "ADB over Wi-Fi"

I'm interested in using "ADB over Wi-Fi" for debugging and troubleshooting my Android Studio application developments?
I already have two tablets that I will like to use for developing instead of using the slow emulator. The problem is that the manufacturer ACER does not provide suitable (Windows 8) ADB compatible driver for them.
I believe the "ADB over WiFi" will make these tablets useful for programming and testing on real devices. I have been searching around but have only found apps requiring a functional USB port on the tablet for the initial configuration.
+Most apps in Google Play require Rooting and a USB in order to work. I do not want to root AND sadly my USB ports are useless, so the question is:
Does anyone of you know any other way to do this? Achieving ADB over Wi-Fi without Rooting and without a USB port?
Thanks all
This one works perfect for me:
https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb&hl=es

How to set development host PC's USB com port as an Android Virtual Device's USB port?

I'm a newbie to the Android development world but have some experience with embedded systems.
I'd like to use an Android phone (4.x or higher) to control other devices via its USB port. We want to set the Android device as a USB host, so solutions where other devices play the host role (e.g. Android Open Accessory Development Kit's Arduino) will not meet our goal.
We are currently using Eclipse-SDK for Android development and successfully have compiled/run/debug several apps. However, I have a very naive question. I was wondering if there is a way one could use the USB port of the development host PC as an input to the Android Virtual Device emulator.
I realize that an easier way to debug the USB-host apps we are writing would be by having a real device. However, the price of the new Ice Cream Sandwich devices is somehow far away from our reach and not the ideal way for debugging an application at its early stages.
I appreciate any help you can provide me with.
The Android Open Accessory Dev kit has been backported to 2.3.4 see here http://developer.android.com/guide/topics/usb/adk.html
So install CM7 or earlier (http://www.cyanogenmod.com/) on your HTC desire and you should be good to go!
Look at the example projects for the 2.3 SDK should help get you going in the right direction.
Path to SDK Samples for me was C:\Program Files\Android\android-sdk\samples
If your looking for USB Host Support basically control and talk to another usb device such as mouse, keyboard, usb thumb drive etc the following should help.
Nexus One as USB Host: http://sven.killig.de/android/N1/2.2/usb_host/
USB Host: External USB devices to Android phones?
Official Android SKD UsbDevice Class: http://developer.android.com/reference/android/hardware/usb/UsbDevice.html
You should take a look at this project, its a great reference
https://code.google.com/p/mover-bot/

Android USB HID Device

Does anyone know how to configure an Android device (tablet) to appear as a USB HID device when connected to a PC?
Is there any other way of getting data from the tablet to the PC (via USB) other than writing it to a file, and have the PC retrieve the (updated) file from the tablet which is acting as a 'mass storage device' for the PC?
Can USB carry a TCP/IP end-end connection?
Using a tablet as a high-end intelligent 'keyboard' or 'mouse' or similar device would be immensely powerful, and open up lots of possibilities. Controlling a model railway layout is the end I have in mind.
Thanks
It's possible to do this using the linux gadget framework http://www.linux-usb.org/gadget/ using a custom composite USB device. The gadget framework is part of the Android kernel source tree by inheritance from Linux.
Unfortunately, Android has its own customizations that restrict the ability to dynamically register new USB gadgets so you will need to patch the kernel source tree for your particular device and add your HID gadget (otherwise you could create a module and load it that way) to the supported Android list.
I have done this before and will update this answer to contain more detail if there is interest. Unfortunately I lost the code so I will have to start from scratch.
If I set up a web server on my phone and enable usb tethering, I can access that server from my PC. If that's not enough for you, this might help: https://market.android.com/details?id=usbwebcam.application&hl=en
I'm running cyanogenmod on a Desire CDMA (BravoC)
Let me know what you find out; it would be pretty handy to use my phone as a USB keyboard in the field. An android server with a PC client is gonna be easiest though.
Have a look at Android Open Accessory Protocol 2.0. This could help you out.

Categories

Resources