How to bypass system dialog asking to allow access to tablet data on Android tablets, specially those by Samsung? I am developing an Android application, which connects with a Raspberry Pi hardware via the USB port. The issue is that this system dialog (as shown in the picture above) pops up every time I connect it. Requiring to tap on 'Allow' every time is resulting in bad user experience. If the user taps to 'Deny' or dismisses the dialog, the Raspberry Pi is unable to detect the connected Android device. 

Is there a way to bypass this? Note that I'm using a non-root Samsung tablet powered by Android.

(Reposted the question here as suggested by someone in the comments. OP here: https://stackoverflow.com/questions/58371723/how-to-bypass-system-dialog-asking-to-allow-access-to-tablet-data-on-android-tab)
The dialog "Allow access to tablet data" is a security dialog, therefore from within an app it is not possible to "bypass" this dialog. As it is currently not yet possible to identify a PC via USB and MTP protocol (may be this is possible in future by authenticated USB) there is also no option available like "always allow this computer to access my files".

Otherwise anybody with access to an unlocked Android device could simply copy e.g. all photos and videos fro the device using USB.

The only known way is to enable the "Developer Options dialog and permanently set the option "USB configuration" to "MTP / file sharing"

Alternatively you could use Android Debug Bridge (adb) ADB instead. On adb level there is a computer authentication which allows to allow a computer permanent access to the device via USB. Of course ADB is disable by default, therefore the user first has to enable the Development menu and the enable adb.