Detected android device connected to PC

北慕城南 提交于 2019-12-07 03:52:30

问题


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?


回答1:


You have to listen for one of this notifications

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

Other USB events aren't clearly described in the documentation

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

http://today.java.net/article/2006/07/05/java-and-usb

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




回答2:


java device detection

This site have a guide on how to detect device with java web and java core

http://51degrees.com/Support/Documentation/Java/GettingStarted.aspx



来源:https://stackoverflow.com/questions/2935249/detected-android-device-connected-to-pc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!