Connection to HID USB device (keyboard and mouse) in android - java

I am trying to develop an android app for managing HID devices.
Using UsbManager and getDeviceList() provided from google sdk and following the android sdk official documentation, I am in condition to set up a connection with various devices (as pen drives, external HD, usb "phone" etc.), but I am not in condition to connect the android smartphone to usb mouse and keyboard: they are not listed by getDeviceList() method at all, even if android OS is able to recognize and use it!
In fact, I am using the mouse and the keyboard with the mobile without any problem.
I am using for my test a samsung galaxy S4.
Any one can give me some explanation about this, please?
Thank you!
p.s.: I also tried to use app like "USB Host Diagnostic" and the result is the same: the app can not recognize connected mouse and keyboard...but mouse and keyboard are still working perfectly...

Have you looked at Android Open Access Protocol yet? In the section titled HID Support:
The AOA 2.0 protocol adds four new USB control requests to allow the accessory to act as one or more HID input devices to the Android device. Since HID support is done entirely through control requests on endpoint zero, no new USB interface is needed to provide this support.
HTH.

Related

Turn on mobile earpiece forcefully

Following is the scenario:
Headphones with mic are connected to a mobile device.
What i want to achieve programmatically:
After a call is been initiated, audio from 3.5mm jack should (forcefully) be routed to mobile earpiece rather then headphone speakers, while the mic should be used of the headphones.
I have searched a lot on google but found methods only to forcefully turn on mobile external speakers.
Reference : how to turn speaker on/off programmatically in android 4.0
While, my goal is to turn on earpiece forcefully.
My research from google:
To achieve this there might be possibilities of system (root) permissions, which a third party application might need.
You may have to write a modified audio driver from sources ? As the functionality is based on the operating system.
If it is possible, can any one guide me on this ?
UPDATE
One more reference: Android - Getting audio to play through earpiece
But the above code does not work on all phones.

FRONT_CAMERA not supported d error: Video Chat Feature powered by Applozic

I have the following issue (since about a week) and unfortunately I have not been able to resolve it:
I'm using applozic especially as a video chat feature for my app. I want to deploy it on an android 6.0 powered smart glasses devices. The app starts, connects to the applozic server, all functions from my app work well and then, when I try to connect a WebRTC video call, this is what happens:
01-31 11:02:41.331 3580-3580/com.package.name W/System.err:
java.lang.IllegalArgumentException: FRONT_CAMERA is not supported on
this device [...]
Audio works, the chat feature works, so I "believe" the error message that is thrown. Is there anything I can do from my side to fix this issue, or is applozic simply not supporting devices that only have one camera?
I already tried the following:
Uninstalled and reinstalled the camera app
Installed a different android camera app
Added all additional manifest permissions I could think of
Logged into the web app (Java Script API) with the device and it works
Tested it with 5 different smart phones and it worked well, which made me
believe applozic does not support devices that only have 1 camera.
Compiled + Targeted a higher and a lower SDK
After contacting applozic (they responded very fast what I appreciated), I was presented with a workaround approach by inserting a modified audioVideo module. After tweaking this module a little bit, I'm now able to use a device that either only has a front, or back camera when doing a live video call.
So I suggest that if you run into the same issue, you contact applozic support: https://www.applozic.com/ and refer to this stackoverflow thread.

USB Host + Power support

In a project I am currently working on, I am using a PIPO T9 tablet to run an app that uses the USB port to communicate with a transceiver. The reason I chose this tablet is because it has a usb port and a 5vDC power input (seemingly) allowing it to be powered while the USB port is in use. I found out later that only one can be used at a time.. So now I have been searching for a way to either:
Programattically force the tablet to disable USB host while the app is not being used. Hopefully allowing the tablet to switch to charging from the 5vDC line, or
Use an OTG Y cable to charge and get data from the USB port
So far I have tried the OTG Y cable method and it seems that this wont work with the tablet. When the tablet is off it has no trouble charging but as soon as its switched back on, charging stops. I have seen some similar questions on here and the recommendation was to use USB Accessory mode but I'm struggling to find out whether this will work with a tablet running 4.42 (NOTE: This tablet has been Rooted).
As always if anyone has any advice I would hugely, hugely appreciate it.
Thank you in advance :)

Control a desktop application using an android phone

I want to build an application where an android phone would control a desktop application.
I only need to send coordinates from the phone to the desktop when user's finger is on the phone screen.
But I am kinda confused on the networking side if i should use bluetooth, usb, or wifi (intranet).
I did some research on bluetooth, doing bluetooth socket programming on an android phone shouldn't be a problem, but on the desktop side there are only a few free SDK/library. any suggestion on what to use?
If I were to use USB/cable, What API on the android side I need to use?
I am actually more familiar with general socket programming (wifi), but I think it's going to be slow (correct me if Im wrong) so this would be my last option.
PS: I am using Java for the desktop application too
any suggestions on what method to use? or even maybe I should use .net on the desktop side?
Thanks
You might find the open source RemoteDroid app to be useful in creating your app. It may even do everything that you want.
The source code is here. You may need an svn client like TortoiseSVN in order to download it.
Wifi is probably the most supportable.
Bluetooth requires hardware and drivers on the PC side
USB would ordinarily seem like the most sensible if the wire isn't a problem, but the catch is that it requires that the user enable "USB debugging" on the phone, and have either the android SDK or equivalent functionality to the adb forward command installed, plus a compatible USB driver for the phone. If all that were the case, you'd just forward a port from the PC to the phone and have a pc program connect to that port on the loopback interface which will be forwarded to a service running on the phone.
It's possible you could do something piggybacked on the USB tethering capability of more recent releases to get you a network-over-usb that you could use to connect programs on the PC and phone, but you'd need modified PC drivers so that you don't actually push the PC's internet traffic through the phone (unless you mean to tether as well).

How to interoperate between PC and camera from cell phone

My new project is to build an application to use the cell phone camera as the main camera from my PC.
How can I do this kind of stuff?
I thought of using bluetooth, but how my PC define the cell phone as the main camera?
Best reguards.
Depending on the camera phone and its features, you can do it. For my Bluetooth efforts, I've been using A7 hardware and a .NET library Blue Tools from Franson.
I've been able to:
pair devices in code
send/push images to the phone (probably the reverse would work, but I didn't try)
discover devices automagically
serial comm
network com
install as a network driver
Well on the Bluetooth side of things you might need a program running on you phone to forward the images. Or you might find that there's a Bluetooth program already running and providing that service, for instance the Bluetooth BASIC IMAGING PROFILE (BIP) (1) profile includes the usage scenario: "Use of a mobile phone to control the shutter of a digital still camera and immediately examine the result on the phone’s screen. In the present scenario, any other portable imaging device could play the role of the mobile phone."
So first you need to find if the phone supports BIP. You could for instance use the SdpBrowser sample application in my 32feet.NET .NET Bluetooth library to see what services the phone is advertising. Otherwise perhaps its documentation will tell you. You'd then have to find out whether the BIP service on your phone supports that scenario.
On the PC side you might need some driver level software to allow any application to use the remote camera. You might start by just allowing your own application alone to use the camera.

Categories

Resources