I am developing a Flutter app that needs to access a USB device. I have added the necessary permission in my AndroidManifest.xml file, like the next:
<uses-feature android:name="android.hardware.usb.accessory" />
<uses-feature android:name="android.permission.USB_PERMISSION" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
and I also added the next in the mainfest file:
<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" />
I am using usb_serial: ^0.4.0
package to make the connection process.
I have also tried to download a fully working Flutter project that uses a USB communication, but it gave me the same error, so its now something related to the project rather than being related to the Android platform. another part of the error was like this:
Caused by: android.os.RemoteException: Remote stack trace: at com.android.server.usb.UsbUserPermissionManager .checkPermission(UsbUserPermissionManager.java:741)
so can anyone help me to solve it?
I have tried to take permission from the user, but non of the permission lines that I added were giving any popup message to the user, and I couldn't take the user's permission.