Android Question USB Host Remember Permission (SOLVED)

walterf25

Expert
Licensed User
Longtime User
Hi everyone, I am working on an app that needs to display some text on a secondary display, I have bought this device which is called Rokid Max AR glasses, essentially it's just an external display that can be plugged into the usb-C port of any Android device and be used as an external display while wearing the glasses. Very cool device actually ;).

Here's the link to the glasses so you guys can have a better idea
Rokid Max AR

So far the app works just fine, but I am having an issue that when the glasses are unplugged from the Android device, and then re-plugged back in I always get the following pop up message.
Screenshot_20231201_091310_One UI Home.jpg


This is what my manifest content looks like, including the intent filter to detect the specific device by product id and vendor id.
AddPermission(android.permission.WRITE_EXTERNAL_STORAGE)
RemovePermission(android.permission.RECORD_AUDIO)
AddManifestText(<uses-feature android:name="android.hardware.usb.host"/>)
SetActivityAttribute(main, android.directBootAware, "true")
'''AddManifestText(<uses-permission android:name="android.permission.CHANGE_CONFIGURATION"/>)

AddReceiverText(USBDetectionService, <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>)

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>
<!-- 0x0403 / 0x6001: FTDI FT232R UART -->
<usb-device vendor-id="1234" product-id="5679" />

</resources>
)

I am using a Samsung Galaxy S23 Plus running Android 13, I'm not sure if this is a USB library issue or a specific android device issue, does anyone have any idea how to get rid of this pop up message each time?

Update:
Didn't realize I had to add the Audio_Record permission, added it to the Manifest and works all good now.

Thanks Everyone
Walter
 
Last edited:
Top