USB open accessory permissions through a service in android
<p>Good day,</p>

<p>I have an application which connects my android device to an arduino unit through a service. I have managed to make the connection but it keeps asking me for permission to  use the accessory whenever I plug it in. Is there any way to bypass this permission? It works perfectly with an intent filter if I do it through an activity, I have tried applying the same intent in the service but it does not seem to work :/. </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="blink.service"
    android:versionCode="1"
    android:versionName="1.0" &gt;

    &lt;uses-sdk android:minSdkVersion="10" /&gt;
    &lt;uses-feature android:name="android.hardware.usb.accessory" /&gt;
    &lt;uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /&gt;

    &lt;application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" &gt;
        &lt;activity
            android:name=".ActivityCreate"&gt;
             &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
        &lt;receiver android:name=".StartupIntent" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt;
            &lt;/intent-filter&gt;
        &lt;/receiver&gt;

        &lt;service 
            android:name=".MainService"
            android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" /&gt;
            &lt;/intent-filter&gt;
            &lt;meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
                android:resource="@xml/accessory_filter" /&gt;
        &lt;/service&gt;
        &lt;uses-library android:name="com.android.future.usb.accessory"/&gt;

    &lt;/application&gt;



&lt;/manifest&gt;
</code></pre>

<p>Here is the code in my manifest.
Thanx</p>
