Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detected android device connected to PC

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?

like image 915
Nadav bg Avatar asked May 29 '10 13:05

Nadav bg


People also ask

Why won't my computer recognize my phone when I plug it in?

If you're struggling to connect your Android phone to the computer with a USB cable to transfer some files, it's a familiar problem you can fix in a few minutes. The problem of the phone not recognized by pc is commonly caused by incompatible USB cable, wrong connection mode, or outdated drivers.

How do I get my PC to recognize my Android phone?

On your Android device open Settings and go to Storage. Tap the more icon in the top right corner and choose USB computer connection. From the list of options select Media device (MTP). Connect your Android device to your computer, and it should be recognized.

Why is my Android phone not showing up on my computer?

Start with the Obvious: Restart and Try Another USB Port Before you try anything else, it's worth going through the usual troubleshooting tips. Restart your Android phone, and give it another go. Also try another USB cable, or another USB port on your computer. Plug it directly into your computer instead of a USB hub.


1 Answers

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

like image 138
RoflcoptrException Avatar answered Sep 24 '22 23:09

RoflcoptrException