USB主机模式-已授予但未记住设备访问权限 [英] USB Host Mode - device access permission granted but not remembered

查看:142
本文介绍了USB主机模式-已授予但未记住设备访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个完美运行的USB主机模式应用程序.我插入了设备,Android弹出了允许应用程序APPNAME访问USB设备?权限请求窗口,我选中了默认用于此USB设备复选框并点击确定,然后出现我的应用程序,它可以与USB设备完美通信.

I have a USB Host Mode application that works perfectly. I plug in the device, Android pops up the Allow the app APPNAME to access the USB device? permission request window, I check the Use by default for this USB device tick box and tap OK, then up comes my app and it communicates with the USB device perfectly.

但是...

然后我拔下设备,然后重新插入.Android弹出允许应用程序APPNAME访问USB设备?对话框.什么我已经告诉Android默认执行此操作,那么为什么又要问我?

Then I unplug the device and plug it back in. Android pops up the Allow the app APPNAME to access the USB device? dialog again. WTH? I've already told Android to do this by default, so why is it asking me again?

在Icecream Sandwich 4.0.3和Jellybean 4.1中都会发生这种情况.

This happens both with Icecream Sandwich 4.0.3 and Jellybean 4.1.

理想情况下,即使我重新启动Android设备后,我也希望Android记住我已经授予了对此特定USB设备的许可.

Ideally I want Android to remember I've granted permission for this particular USB device even after I've rebooted the Android device.

那么Android为什么不记得我已经授予了权限?

So why isn't Android remembering that I've granted permission?

推荐答案

这是

This is a dup of USB device access pop-up supression?. Basically the answer is to use an intent-filter on USB_DEVICE_ATTACHED and steer clear of the RequestPermission USB Host Mode API call.

这篇关于USB主机模式-已授予但未记住设备访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆