Questions tagged [android-usb]

Questions regarding the implementation of USB communication on Android through one of the two supported modes: USB accessory or USB host.

Android supports a variety of USB peripherals and Android USB accessories (hardware that implements the Android accessory protocol) through two modes: USB accessory and USB host. In USB accessory mode, the external USB hardware act as the USB hosts. Examples of accessories might include robotics controllers; docking stations; diagnostic and musical equipment; kiosks; card readers; and much more. This gives Android-powered devices that do not have host capabilities the ability to interact with USB hardware.

110 questions
14
votes
2 answers

Grant USB permissions as device owner

A device owner can grant runtime permissions to a third-party app using DevicePolicyManager.setPermissionGrantState() to avoid user prompts. But is there any way for a device owner to grant USB permissions as well, so that this app gets access to…
sdabet
  • 18,360
  • 11
  • 89
  • 158
10
votes
2 answers

Persisting USB permission after reboot without replugging device

In an Android app, I need permission for a specific USB device (known vendor/product ID), which is permanently plugged on the Android device. So far I've made the following observations: when using UsbManager.requestPermission() the permission is…
sdabet
  • 18,360
  • 11
  • 89
  • 158
10
votes
2 answers

Why can't this specific device be enumerated by UsbManager.getDevicesList()?

As the title states, I am having troubles enumerating a specific USB device on a USB capable Android phone using UsbManager.getDeviceList(). I've had no trouble enumerating and communicating with other USB devices on this and other phones, but this…
Mike Ortiz
  • 4,031
  • 4
  • 27
  • 54
9
votes
1 answer

Use libCEC + USB dongle in Android app

My goal is to send HDMI CEC commands from a standard (i.e non-system) app running on an Android box equipped with Pulse-Eight's USB dongle. Following these instructions I successfully managed to compile libcec for Android and execute it as root on…
sdabet
  • 18,360
  • 11
  • 89
  • 158
9
votes
1 answer

How to grant permission to open usb device with usb manager? openDevice() always returns null

I want to use a usb device in the following code. It successfully lists the usb devices and iterates over them. In the following code the object "device" is the usbdevice that i need to open. Everything seems Ok except the OpenDevice() method that…
a.toraby
  • 3,232
  • 5
  • 41
  • 73
8
votes
2 answers

USB webcam support in Nougat Camera API

I am building a Nougat AOSP image for Raspberry Pi 3 following these instructions: https://github.com/tab-pi/platform_manifest. And I have a UVC-compatible USB webcam (Logitech C525) that I would like to access through Android Camera API. So far the…
sdabet
  • 18,360
  • 11
  • 89
  • 158
8
votes
3 answers

USB Permissions without prompt

I have 2 activities within my app. Say FirstActivity and SecondActivity. FirstActivity is the MAIN and LAUNCHER activity. SecondActivity uses usb devices. I want the prompt for USB permission to appear only once within lifetime of the app. If…
jay
  • 1,982
  • 2
  • 24
  • 54
7
votes
2 answers

How to use the same Usb accessory for two apps at same time?

I have an app that uses I want that USB to communicate with the App1 running in the foreground and App2 running in the background. The App2…
jknair0
  • 1,194
  • 13
  • 24
7
votes
0 answers

how to check otg support option is enabled or not

Currently one of our app required to external device connectivity. So, I want to know how to check OTG support option in settings is enabled or not programatically. This question might explains whether OTG is supported but I'm looking for settings…
AskQ
  • 4,215
  • 7
  • 34
  • 61
7
votes
1 answer

How to get in Android Usb Host what Usb Device responses after Host sends command?

Following the simple tutorial I'm able to connect to device (usb optical mouse with ADNS-5000 chip inside) and make a bulkTransfer. UsbInterface intf = device.getInterface(0); UsbEndpoint endpoint = intf.getEndpoint(0); UsbDeviceConnection…
Marian Paździoch
  • 8,813
  • 10
  • 58
  • 103
7
votes
1 answer

How to Fix unplug usb cable error in android with usb web cam?

I Was created a android application based on connecting with webcam. The application works charm while connection with webcam. But when i unplug, my mobile the application crashed and shows "unfortunately application was stopped its working". Video…
5
votes
0 answers

How to record high quality audio from USB microphone without external libraries

I am struggling on how to capture the audio stream from connected USB microphone. I have tried to use the MediaCapture with MediaRecorder.AudioSource.MIC as source which worked but recording quality isn't quite usable for me and you can't be sure if…
Marjan Slavkovski
  • 633
  • 1
  • 7
  • 20
5
votes
2 answers

Suppress UsbRequestJNI / ALOGD log messages

I'm developing an Android app which is streaming serial data from some custom hardware. I'm using mik3y's usb-serial-for-android library to get the serial data over USB in OTG mode, which after some tweaks is working fine. However, for every…
davidf2281
  • 1,319
  • 12
  • 20
5
votes
0 answers

android UsbDeviceConnection.requestWait() with timeout

I am trying to interface a USB tuner card to the android device (version 19). Currently I am using UsbDeviceConnection.requestWait() to read the data followed by UsbRequest.queue of 16kb. Things all work fine. In case of no input for the tuner…
5
votes
1 answer

Android usb host api and USB storage

I am trying to use the android host api for USB storage. I have many doubts regarding same. What all things are possible using host api. I want to see the content of USB and if possible so the normal file operation. I didnt find any documentation…
Brijesh Masrani
  • 1,439
  • 3
  • 16
  • 27
1
2 3 4 5 6 7 8