I've got the Serial component working, and can communicate with an Arduino attached to my phone with an OTG USB cable.
I plug in the USB cable into the phone, and then open the app. When I attempt to open a serial connection, the phone alerts me with a pop-up notification that says:
Allow the app [app] to access the USB device?
[ ] Use by default for this USB device
I would like my phone to remember the USB permission choice so that once the permission is given, it does not ask again. Checking the default box seems to have no effect.
- If the USB cable is unplugged, upon replugging the pop up will come back.
- If the phone is rebooted, the pop up will come back.
- However, if the app is closed, but the cable remains plugged in, and then the app is reopened, the pop up does not come back.
In the phone settings, I can go to settings/apps/[my app]/permissions, and see a list of permissions allowed for my app. But USB access is not on the list.
The answer for this stack exchange post is referenced by a number of other stack posts, all dealing with this USB pop up. It discusses changing the manifest and adding USB "intents":
Has anyone ever tried this within AI2, or is it even possible? I'm guessing something like this might be possible through the activity starter component, or perhaps in post-processing with something like Java Bridge?
Or does anyone have any other avenues I may try (like an AskForPermission within the initialize block)? I am simply trying to make my phone remember the USB permission so that it does not ask every time the USB cable is plugged in.
Attached is a sample program: ArduinoInterface.aia (3.7 KB)
Thanks.