Programatically identify if a connected device is Android from PC

3.3k Views Asked by At

If I connect an android smart phone through USB cable to a computer, I want to know if the connected device is running Android. Based on that I am going to show some notifications on the computer.

How to programmatically identify this from a windows PC?

I am trying to get a logic something similar to how Mobiledit does.

[Note: I cannot turn on USB debugging in the phone]

1

There are 1 best solutions below

1
On

You can list connected devices using Windows Portable Devices API, and then filter results, using list of possible android devices as Appleman1234 suggested. Problem is that far as I know WPD API doesn't have C# wrapper so you'll have to use PInvoke to write your own.

There are 2 articles on MSDN which can help:

  1. Creating a Temperature-Sensor Gadget for Windows Sidebar with C# - basics of using WPD with c# and PInvoke.
  2. Enumerating devices using WPD API in C++