I have created an application which transfer data from android to android over wifi. I am exploring usb host apis to add support for data transfer over usb. I am following android docs for host apis
https://developer.android.com/guide/topics/connectivity/usb/host
and followed all the steps. So far I am able to grant permission to the selected device lets say phone "A" and opened usb device successfully to write data , but i don't know how to create/access usbdevice on other phone "B"? I have seen other phone isn't notified about the usb attached/unattached events. When I added "android.hardware.usb.action.USB_STATE" other side is notified by event change but I don't know how to get/access usbdevice object on phone "B" to initialize read/write data? Does the current host protocol is one sided protocol? Any help in this regard will be highly appreciated.
After reading further I was able to identify the problem. I had to force accessory mode in device from host, by sending special controlTransfer messages.
I found it here
https://github.com/peyo-hd/TcpDisplay/blob/master/sink/src/com/android/accessorydisplay/sink/SinkActivity.java