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
1
vote
2 answers

Inside my Android app (java), I want to retrieve IP address while connecting my Android with usb connection to another device

I am pretty sure it's possible as I successfully got same from termux Android app where I installed nmap and ran following commands: Run ifconfig first and get the device IP (xxx.xxx.xxx.x) Run nmap -sn xxx.xxx.xxx.x/24 Note: the device was not…
singhV
  • 157
  • 9
1
vote
2 answers

How to restrict user to connect USB when my Android app is running?

I want the user to stop the USB connection to the PC when my app is running on his Android mobile like Google Pay and some other apps do. How to do this as. How to show the user an alert to remove the USB connection when he connects mobile to PC…
Bhaskar Jyoti Dutta
  • 1,740
  • 2
  • 15
  • 30
1
vote
3 answers

How can I get text data from Handheld QR code scanner?

I am using honeywell barcode scanner(HF680). And I connected it to my Android Device(Desktop). I need to get the scanned data as text. It works like keyboard. So, It seems like I can't get the data internally like Camera Scanning. How can I approach…
c-an
  • 3,543
  • 5
  • 35
  • 82
1
vote
0 answers

Check pen-drive is connected or not in android_q init.rc

if pen-drive is connected ,We have to run some device testing application(it should not enter into android). If pen-drive is not connected , android should be boot-up . For this scenario,how can we check pen-drive is connected or not in init.rc.
GNK
  • 1,036
  • 2
  • 10
  • 29
1
vote
1 answer

Sending a simple USB BulkTransfer and receiving a response

I am trying to get a weight value from a set of weighing scales over USB. It should be quite simple, according to their doc, I need to send two bytes the letter "W" and the carriage return byte. It then responds with 16 bytes of data representing…
Daniel Wilson
  • 18,838
  • 12
  • 85
  • 135
1
vote
0 answers

Android x86 disable USB device or driver or choose bluetooth device?

I'm running Android x86 on Parallels Desktop and their virtual bluetooth device simply doesn't work. I would like to use my Android-compatible USB dongle (CSR8510). I can do this with Windows 10 by disabling the virtual device in the Device Manager,…
ball
  • 21
  • 1
1
vote
0 answers

Android 10 stacked USB permission when using intent-filter to start activity when USB attached

My setup Pixel 3/Android 10 (but same problem on Samsung Galaxy S9/Android 9) App targets API 29 (Android 10) A USB device On Android 10 there has been a change to the permission model, which means reading serial number for a USB device requires…
Alix
  • 2,630
  • 30
  • 72
1
vote
0 answers

hid_get_feature_report analog in Android USB Library

What would be analog to hid_get_feature_report in Android USB Library? I need to get relays state from usb relays device on Android. I found example on C (for Linux/Windows): https://github.com/darrylb123/usbrelay/blob/master/libusbrelay.c static…
user924
  • 8,146
  • 7
  • 57
  • 139
1
vote
1 answer

Physical USB Keyboard for coding on the Android AIDE app

I am running Android 8.1 Oreo on a smartphone device. I would like to know, can I mount this KeyTronic USB Keyboard onto my Android phone using a USB to microUSB Adapter? I want to use it in place the default GBoard soft Keyboard on Android, and use…
1
vote
1 answer

bypass-android-usb-host-permission-confirmation-dialog

I am trying to bypass usb permissions on android when android is used as host, i followed this link which provides the way to do it on Android 4.x bypass android usb host permission confirmation dialog This doesn't work on Android 9.0, however.…
sasfour
  • 399
  • 1
  • 3
  • 10
1
vote
0 answers

How to get response from USB Device after using UsbDeviceConnection.bulkTransfer

So basically what is happening is I have a tablet connected to a printer that I send files to using UsbDeviceConnection.bulkTransfer. I can successfully send the file and everything works but the printer is supposed to send a return code after it…
Darian B
  • 317
  • 2
  • 3
  • 15
1
vote
0 answers

USB Accessory Attached on Boot Permissions

I have an app and an accessory and I'm having issues with the USB_ACCESSORY_ATTATCHED intent not being fired when the device is booted and the accessory is already plugged in. The workflow works great when the device is on and the user plugs in the…
Erik
  • 493
  • 1
  • 7
  • 18
1
vote
1 answer

Prevent USB_DEVICE_ATTACHED launching app after a reboot

I have an activity listening for the USB_DEVICE_ATTACHED broadcast intent, which launches when the user plugs in my USB device and selects our app. My problem is the android host devices reboot themselves once a day (usually around 4am), at which…
Daniel Wilson
  • 18,838
  • 12
  • 85
  • 135
1
vote
0 answers

How to use Android functionality in web app like "progressive web app"

I have developed hybrid mobile applications, there I am able to use Android functionalities like USB connectivity, Bluetooth connectivity etc. Now I want to develop same app as web app which will run on desktop browsers and mobile browsers, but the…
1
vote
1 answer

USB host: how to open my app only if it is not already in foreground?

I know that I can use USB host mode with this manifest configuration:
manfcas
  • 1,933
  • 7
  • 28
  • 47