Here is my schematic schematic
- My device is a non-standard USB device
- I only use the 5V power of cellphone to supply my device by connecting the ID pin to ground
- I connect the D- pin to 5V with a 1.5k pull-up resistor in order to tell the phone there is a voltage change on the D- pin when my device plugged in
- I don't use the D+/D- pin to communicate with the phone
My question: how to detect the device when it attached to an android phone? I have tried to read the both variable
UsbManager.ACTION_USB_DEVICE_ATTACHED
android.hardware.usb.action.USB_STATE
both have no change.
but weird is when I insert a USB wire the android.hardware.usb.action.USB_STATE =connected