连接到PC检测到Android设备连接到、检测到、设备、PC

2023-09-03 03:56:22 作者:重来只怕我们都没有力气

嘿, 我有一个机器人德维克,我想知道什么时候是通过Java连接到PC / .NET 我知道它有可能 - 三星New PC Studio中是做什么的,当过我连接Android设备它让我知道。我怎样才能达到同样的?

Hey, I have an android devic, i wish to know when it is connected to the pc via java/.net i know its possible - the Samsung New PC Studio is doing it, when ever i connect an android device it lets me know. how can i achieve the same?

推荐答案

您要听这个通知的一个

http://developer.android.com/reference/android/content/ Intent.html

如果你使用它作为一个大容量存储设备,然后用这个

If you're using it as a mass storage device then use this

的http://developer.android.com/reference/android/content/Intent.html#ACTION_UMS_CONNECTED

其他USB活动都没有明确的文档中描述的

Other USB events aren't clearly described in the documentation

编辑: 如果你想读计算机端我会读这篇文章

If you want to read on the computer side I would read this article

http://today.java.net/article/ 2006年/ 07/05 / java的和-USB

,然后检查哪些类型的设备连接到USB端口。如果它是一个手机,那么你可以尝试发送短消息给它。您的手机上,你做一小块code,它返回一个合适的答案,所以你可以发现这就是它的真正的Andr​​oid /手机/你要确定这个电话

and then check which kind of devices are connected to the usb port. if it is a mobile phone, then you can try to send a short message to it. on your phone you make a small piece of code which returns an appropriate answer so you can detect thats its really android/your phone/this phones you want to identify