views:

119

answers:

1

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?

+1  A: 

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

Roflcoptr
Those are for the case where you want to detect on the device if the device is connected. The Samsung PC Studio Manager is a Windows desktop program, as near as I can tell.
CommonsWare
Ah ok sry then i misunderstood the question. But if its necessary to detect on the PC, then i don't rellay need code on Android, but instead some programm on the pc which checks the ubs ports
Roflcoptr