0

We have an application that uses Android and USB on the go to communicate with an Ardupilot. Our phone is logging information from the ardupilot and some other things. The problem is that often when logging we don't have easy access to the screen of the phone. This means that if we have a problem where a USB cable loosens(which happens a bit to often) we need access to the screen to grant permission to the USB device. Is there any way to grant permission always. The application is only internal so we are not that worried about security, but need the convenience.

Note: We have tried to select the "Remember this choice in future", but the dialog always opens and it doesn't seem to remember our choice.

Edit: As requested the manifest lines where we have requested USB:

<uses-feature android:name="android.hardware.usb.host" />
                        ...
<activity
        android:name="..."
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />

            <meta-data
                android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
                android:resource="@xml/device_filter" />
        </intent-filter>
    </activity>

Here is our device filter:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- 0x0403 / 0x6001: FTDI FT232R UART -->
<usb-device vendor-id="1027" product-id="24577" />

 <!-- 0x0403 / 0x6015: FTDI FT232R UART -->
<usb-device vendor-id="1027" product-id="24597" />

<!-- 0x2341 / 0x0010: APM 2.5 device -->
<usb-device vendor-id="9025" product-id="16" />    

<!-- 0x26ac / 0x0010: APM 2.5 device -->
<usb-device vendor-id="9900" product-id="16" />  

<!-- 0x2341 / Arduino -->
<usb-device vendor-id="9025" />

<!-- 0x16C0 / 0x0483: Teensyduino  -->
<usb-device vendor-id="5824" product-id="1155" />

<!-- 0x10C4 / 0xEA60: CP210x UART Bridge -->
<usb-device vendor-id="4292" product-id="60000" />

</resources>
Nordmoen
  • 215
  • 1
  • 7
  • It would be helpful if you could include the USB-related entries from your AndroidManifest.xml in your post. Also, does your app provide the desired behavior on any other Android device? Does any other app from the market provide the desired behavior on your device? This could help determine if it is a mistaken in your usage, or a bug in the platform software on your particular device. – Chris Stratton Jul 24 '14 at 14:42
  • We have only tested on the Samsung S4 as that is the phone model we have selected. My explanation might be a bit off. The problem is not that it is not working. After the user grants permission the application is working and can communicate with the device. What we wish is for the user to not have to grant permission every time. – Nordmoen Jul 25 '14 at 07:07
  • 1
    **There is a solution for almost same problem [here](http://stackoverflow.com/questions/13726583/bypass-android-usb-host-permision-confirmation-dialog) or [here](http://stackoverflow.com/questions/12388914/usb-device-access-pop-up-supression/15151075#15151075)** – Amit Anand Jul 25 '14 at 07:09
  • Thanks @help, apparently our Googlefoo is not good enough – Nordmoen Jul 28 '14 at 07:28

0 Answers0