We have a otg device for different android phone otg enable option is in different location so is there any option to enable otg when app start
We tried but not get any solution for this
We have a otg device for different android phone otg enable option is in different location so is there any option to enable otg when app start
We tried but not get any solution for this
Change the manifest
<manifest ...>
<uses-feature android:name="android.hardware.usb.host" />
<uses-sdk android:minSdkVersion="12" />
...
<application>
<activity ...>
...
<intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />
</activity>
</application>
</manifest>
Create an XML like
<?xml version="1.0" encoding="utf-8"?>
<resources>
<usb-device vendor-id="1234" product-id="5678" class="255" subclass="66" protocol="1" />
</resources>
To work with the device to your requirement follow this developer guide Android Developer link to work with USB devices