USB_DEVICE_ATTACHED只有startsActivity银河S3的ICS银河、startsActivity、USB_DEVICE_ATTACHED、ICS

2023-09-13 01:05:14 作者:独守空城待佳人

最近我一直在试图获得意图android.hardware.usb.action.USB_DEVICE_ATTACHED。

Recently I've been trying to receive the intent android.hardware.usb.action.USB_DEVICE_ATTACHED using a broadcast receiver as per all the samples and examples that I've seen.

我已经声明在清单中一个reciever;

I've declared a reciever in the manifest;

<receiver android:name=".UsbDeviceReceiver">
        <intent-filter>
            <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
            <action android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </receiver>
    <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" 
                android:resource="@xml/device_filter"/>

我也做了活动code相似 - ONSTART和的onStop注册/注销接收器

I have also done similar in the activity code - onStart and OnStop register/unregister the receiver.

    IntentFilter filter = new IntentFilter();
    filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);

    registerReceiver(mUsbReceiver, filter);

不过,我发现的意图只是抓住了。观察logcat的我可以看到,连接USB设备查找活动的开始,而分离广播detatch意图。根据上述的样本,这不应该是这样的。

However, I am finding that the intent is just caught. Observing logcat I can see that attaching a usb device looks for activities to start, while detaching broadcasts the detatch intent. According to the aforementioned samples, this should not be the case.

我缺少关于元数据的一些激烈?我没有任何问题与android.hardware.usb.action.USB_DEVICE_DETACHED。也许,这是安装在银河S3的Andr​​oid版本中的错误?也许这是一个IC的功能。

Am I missing something drastic concerning metadata? I have no problems at all with android.hardware.usb.action.USB_DEVICE_DETACHED. Perhaps this is a bug with the android version installed on the galaxy s3? Perhaps this is an ICS 'feature'.

任何relavent信息欢迎!

Any relavent information is welcome!

推荐答案

这是一个已知的缺陷:

HTTP://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 25701

这里:

HTTP://$c$c.google。 COM / P /安卓/问题/详细信息?ID = 25703

但是,不要屏住呼吸等待它是固定的。当你在寻找bug报告,明星,所以你会得到更新报告的通知。可能会从其他人的意见,要求它是固定的。

But don't hold your breath waiting for it to be fixed. While you're looking at the bug report, star it so you'll get notified of updates to the report. Likely that will be comments from other people asking for it to be fixed.