todbot / blink1-android

Android library for blink(1) USB RGB LED
Apache License 2.0
7 stars 0 forks source link

How to avoid USB popup notification when inserting key ? #3

Open ZeDvD opened 3 years ago

ZeDvD commented 3 years ago

Hi Is there a way to avoid USB popup notification, when the key is inserted, to allow usb access ? I modified the Manifest file with the following, but I still have the popup each time I insert the key :

        <meta-data android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED"
            android:resource="@xml/usb_filter" />

and

<uses-feature android:name="android.hardware.usb.host" />

and

<uses-permission android:name="android.permission.USB_PERMISSION"

and

todbot commented 3 years ago

I don't know much about Android, but I believe that user-authorization is required each time. Perhaps ask on an Android developer forum?

ZeDvD commented 3 years ago

Thank you for your answer, I already checked this point but did not find this answer. Some say that modifying Manifest avoid this problem, but it doen't work for me. I check again.

gavinmahan commented 3 years ago

I’m not an android expert but I think you can do it by using an 'intent filter’, then your app should ask permission just one time.

https://developer.android.com/guide/topics/connectivity/usb/host#using-intents https://developer.android.com/guide/topics/connectivity/usb/host#using-intents

Thanks, Gavin

On Jan 20, 2021, at 1:40 PM, ZeDvD notifications@github.com wrote:

Thank you for your answer, I already checked this point but did not find this answer. Some say that modifying Manifest avoid this problem, but it doen't work for me. I check again.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/todbot/blink1-android/issues/3#issuecomment-763966623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALIQCAVBQ6GUVGTAC4BW7LS25EWLANCNFSM4WLJJZRQ.

todbot commented 3 years ago

oh interesting! Thanks @gavinmahan. I note to use the intent in the README of this repo but not in the checked-in device_filter.xml.