I'm developing an Android Accessory using a Galaxy Nexus phone and the official Arduino ADK board. I'm using all the standard Arduino libraries available here. I'd like to be able to debug my Android code at runtime so I followed Googles' instructions in their "Debugging Considerations" documentation in order to do remote debugging via WiFi.
When I connect to the phone via USB I'm able to debug just fine (of course it's not talking to the Arduino board though). When I connect to the phone via WiFi I can debug just fine. However when I plug in the board to the phone it no longer auto-launches my application (that's registered with the ADK device). So instead I manually start my application but it cannot find the Arduino accessory. If I switch back to USB debugging and reconnect the ADK board to the phone it auto-launches like normal and everything is fine, but then I'm back to not being able to debug.
There are no changes to the code during all of this. All I did was change how the adb tool reaches the phone. Any guesses why the phone and my application can no longer see the ADK board?
In short:
If the phone is set to debug via USB, it can talk to the Arduino ADK with no problems.
If I invoke "adb tcpip 5555 < enter> adb connect < device-ip-address>:5555" I can remotely debug the phone with no problems.
If I now connect the ADK board to the phone with the USB cable, the phone cannot find the ADK board, but I can still do remote debugging via WiFi. That's how I know that the accessory cannot be found.
Edit:
The phone is running Android 4.1.1 and the Arduino is 1.0.1.
Just bumped into this problem, having returned to USB Accessory work. Yes there is a problem, I've no idea how to fix the problem as later versions of Android simply don't allow you to both run adb over wifi and USB Accessory at the same time. My solution and you probably got there already yourself was to root my phone, luckily a Nexus S, and down grade the Android on it to 2.3.6
It's not a great solution but to debug USB Accessory I have to boot into 2.3.6. Hopefully in the future this might work again.
Debugging USB Accessory through wifi is only possible on Nexus devices. I tried many others (Samsung's, Motorola), they don't detect accessory when USB debugging is enabled in settings. Also tried hardware usb switcher - does not help.
Related
I have a Samsung Galaxy S10 running Android version 10, and my USB connector does not work anymore. The Android docs state that I have to connect my phone to the host computer with a USB cable first before debugging via WiFi...
Are there any ways to work around this? I read one StackOverflow post that provided a solution (not sure if it works) for phones that are rooted, but I was hoping there was a simpler way.
Since your device is Android 10 you cannot init a Wireless connection without connecting it via USB first.
I don't know if the S10 is rooteable if you can root your device or it is already rooted you can follow the steps listed here:
How can I connect to Android with ADB over TCP?
You only need to prompt a few commands in your device to enable usb debugging via TCP.
Or you just need to wait for the Samsung S10 Android 11 update. Planned for this month.
I am creating an app (running in USB accessory mode) that will recognise when a specially made device (that I am also working on) is plugged in and connect to it.
I have written code in the app for this recognition to happen but now need to test it and the specially made device is not made yet.
So, I was wanting to test my app by somehow setting my PC up to be recognised as a usb host device that my phone can connect to, I spent a long time googling and looking for a way to do this or a different way to test this but came up empty.
How do I set my PC up in this way to test my app or what would be a good way to test this automatic usb connecting?
Thank you kindly,
EDIT:
Even the name of a cheap device that runs in android usb host mode would be sufficient as I could still just plug that into my device to check if it is working.
I think your question is how to emulate USB Host mode with the Emulator and setting up a bridge with an emulated device on the PC. This is not possible (yet).
See Emulator documentation. In the "What's not supported section" it is said that virtual hardware is not supported for USB.
I'm just starting on some development using the android accessory protocol. I have sourced a starters kit (microchip) to get familiar with the environment. I should note that I' have a solid background in embedded C, but not really in Android / Java.
The kit connects using USB, so I have configured my phone to use ADB over Wifi, which works great. I compile the app and can debug in the phone just fine. However, it will not recognize when the accessory is connected to the USB port. When I stop the wireless ADB, the app will recognize the accessory just fine and works as it should.
I have a hard time finding out whether this is expected behavior or not, but as it would stop any debugging on an app communicating with a USB accessory I doubt it and suspect I am doing something wrong.
I use a Galaxy S3 I9300 rooted, and microchip's Accessory Development Starters Kit and provided samples.
ADB-over-wifi does disconnect after an accessory is connected. To mediate that, switch the phone to accessory mode and after that connect the ADB-over-wifi. That way eclipse can reconnect to the debugging session.
Another way is to run a shell a shell script in the background that will infinitely connect the ADB-over-wifi.
I did not find more elegant ways to solve this problem.
Ok. it seems to be related to the "USB Debugging" option in the developer options. When I disable it, it works as expected.
I have not been able to try it on lots of different phones but on the 2 I have access to this seems to be consistent (Galaxy S3 and HTC One).
I can't find any specifics on this behavior on the net though.
I found the USB docs for Android and from there it seems as if one could write a communication program on an Android phone that works exactly like on a PC.
I have a normal USB-cable that normally connects between a PC and an external device. On one end it is a normal USB on the other end it has a special plug for the device.
If I get an USB female-female adapter I could connect my normal Android phone cable USB end to my device USB cable and so basically plug in my special USB cable into the Android phone.
Does anyone have experience doing USB communcation programming on Android - basically copying normal PC USB functionality? All I would have to do is sent and receive text strings over the USB port - just like on a PC.
Is this possible or is the USB port programming on Android limited in any way
and not really identical to USB programming on a PC? eg. power supply through USB or anything else?
ps on the PC I need to have a FTDI driver installed to work with the external device.
Many thanks
UPDATE:
it seems that starting with Android 3.1 it is possible to do this - however, if I understand htis correctly, Android 3.1 runs only on tablet Android devices - I might be wrong with this - compared to Apple this all this pretty confusing (however, with Apple iPhone it will never work! ;)
Yes, Android supports USB host on 3.1 and newer, so you can connect USB devices directly to an Android device using a converter cable. Android 4.0 brings this feature to handset devices.
I have a general and quick question and since you can never get a hold of a developer at Google, I thought I would post the question here...
Can anyone tell me, if we want to use our phones to connect via USB to a missile launcher made by dream cheeky As suggested on the USB or ADK section of the developer's website, would we still need and Arduino board or a board that Google presented at Google I/O 2011?
I guess I am asking, in short, can we directly hook our phones to another device via USB, and compile a program via eclipse or with the ADK to have it run? or will we still need a board in between the phone and the device we want to connect USB...
Thanks in advance,
Richard
In ADK, the Android device acts as a USB Device and the Android accessory acts as a USB Host. When an Android accessory is attached to the Android device, the Android devices switches to "accessory mode (as described in ADK)". If your Android device has USB host already, still it will switch to accessory mode and acts as USB Device instead of USB Host. Actually, the motivation behind ADK is to make each Android device to work with any Android accessory. Accessory mode eliminates the need for USB host, since only few devices has USB host feature (It is costly).
So, if you want to work with ADK, you need an development card with USB host.
you do not need an ADK board if the device that you are connecting to your Android device is acting as the USB Device and your Android device is acting as the USB Host. This is the case with the Dream Cheeky USB missile launcher. You can connect a missile launcher directly to the device and control it. USB Host is only supported on Android 3.1 devices and later.