USB连接的通知 [英] USB Connection notification
问题描述
我们可以收到通知,如果用户通过USB电缆连接有电话。
can we receive notification if user connected there phone through USB cable.
推荐答案
阿贾伊,
我是不是能够找到具体的,只是什么USB已连接,但也有少数广播操作,可能会感兴趣的,具体取决于您所要完成的这种情况:
I wasn't able to find anything specific to just "USB Connected," but there are a few Broadcast Actions that may be of interest in this case depending on what you are trying to accomplish:
-
ACTION_MEDIA_SHARED
:外部介质卸载,因为它正在通过USB大容量存储共享 。
-
ACTION_UMS_CONNECTED
:该设备已进入USB大容量存储模式。这主要是用于USB设置面板。 -
ACTION_UMS_DISCONNECTED
:该设备已退出USB大容量存储模式。这主要是用于USB设置面板。
似乎没有成为一个广播事件具体到USB简单地被插入时,你也可以尝试做一些有:
There doesn't seem to be a Broadcast Action specific to USB simply being plugged in, you could also try doing something with:
-
ACTION_POWER_CONNECTED
:外接电源已连接到设备 。
但是,这会熄灭两个USB连接到电脑和USB只能连接到电源...
But this would go off for both USB connected to a computer and USB connect ONLY to a power source...
有趣的是,我也发现了这个 LINK 简单的声明没有广播事件为USB连接。
Interestingly, I also found this LINK simply stating that there was no Broadcast Action for "USB Connected".
您可能是出于运气在这种情况下: - \
You may be out of luck in this case :-\
这篇关于USB连接的通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!