I want to set up USB tethering from an Android phone connected with windows/Linux PC and make TCP calls between each other. When I try to make TCP calls I see ENETUNREACH error. So I came to conclusion that I have to set permission in Android app to communicate with other device.
As per android developer manual, I add intent filter for USB connection as
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter
and permission as
<uses-feature android:name="android.hardware.usb.host" />
and in the onCreate function I try to get the USB device details as
UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE);
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
UsbDevice device = deviceList.get("deviceName");
But I always see that deviceList is always null, Can you please help me ?