Android Question ioio service and open_accessory

jimseng

Active Member
Licensed User
Longtime User
Hello all.
I am trying to get my head around usb_accessory and a ioio. (I have struggled for a couple of days to get the ioio otg to work but I have it working in my app using open_accessory.
I have a service that starts when a text message is received that tries to initialise a connection with a ioio board. The problem seems to be that the app starts before android asks to allow the app to access the accessory. Even when I check "use by default" it still asks every time.
I am rather new to this so if anybody has done something like this I would like to hear about it.
Basically my app doesn't connect to the device and quits.
Is it something to do with the AndroidManifest.xml?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Delete the xml file if you already added it and try this manifest editor code (requires B4A v5.8+):

B4X:
AddActivityText(main, <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" />)
CreateResource(xml, device_filter.xml, 
<resources>
<usb-accessory model="IOIO" />
</resources>
)
 
Upvote 0
Top