0

I have an app on a tablet android 8.1 that opens when i attach a usb device and is setted by home default.

The first time i attach the usb , android asks me if i can open app when the usb device is connected and i apply it by default , the device work .

But everytime i reboot the device and the app opens , it show me the pop up again. i really need to bypass this fact because this fact is not accettable for the user experience.

The action that i made are:

  • install the app
  • attach the usb device
  • app opens
  • this pop up appear :

enter image description here

-i click on Use by default

-the usb device work

-reboot device

-the pop up returns

i tried to following these guides but none of them worked for me , expecially because i'm not experienced enough with java: -USB device access pop-up suppression

-How to handle App permission pop ups

-how to prevent android from getting popup

-Remember USB connection, but don't launch the application

my manifest :

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.liliumduva">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-feature android:name="android.hardware.usb.host" />
    <uses-permission android:name="android.permission.USB_PERMISSION" />
    <uses-permission android:name="android.permission.USB_PERMISSION" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.REORDER_TASKS" />
    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <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" />
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>
</manifest>

I really need help i'm really stuck with this , thank you in advance for the help

1 Answers1

0

To bypass this i created a boot receiver java class that close the app on device reboot. Then with the help of tasker i made it click on ok on the pop up and then i make the application launch always with tasker. if you want further information i will share code .