How to get OS version and Device Name of an Android device connected via USB with C#.net (VS2010/4.0+)?

15,375

You can use the Android Debug Bridge from the Android SDK to query properties from the connected devices. You can simply launch the adb.exe process from within .NET and use the results.

For example adb.exe shell getprop ro.product.model will give you the model name, and adb.exe shell getprop ro.build.version.release will give you the Android version number. To get a complete list of all available properties for a given device, you can also just run adb.exe shell getprop.

Note that the property names are not really standardized and manufacturers are not required to put in valuable names. It’s common that the product model contains the device’s code name or a product identifier that is not commonly used to identify the product among consumers.

Share:
15,375
rumit patel
Author by

rumit patel

Updated on June 27, 2022

Comments

  • rumit patel
    rumit patel almost 2 years

    I want to build a windows application in C#.net which should identify the installed Adroid OS version (e.g. 4.0) and user friendly Device Name (e.g. Samsung Galaxy S3, Samsung Galaxy Tab 8.9 etc.) when you connect an Android device to your computer via USB.

    I tried with the System.Management class to identify the connected USB devices on my machine, however, the problems I had were:

    I just have 3 USB ports and connected the Samsung Galaxy Tab 8.9 on one of the USB ports and tried to get the list of USB devices using USBhub WMI class and I got around 6-7 results in the list including the Samsung device. So, the issues here are:

    1. Why did I get 6-7 results when querying USBHub? Am I doing anything wrong here?

    2. How can I filter my records to list only those USB ports which has an external device connected to it not 6-7 results?

    3. I could not find the correct/user friendly Device Name I was expecting (e.g. Samsung Galaxy Tab 8.9) and no way to get the Android version OS. I tried 'Caption' and 'Description' properties, but they have very generic information such as just 'Samsung'. How can I get the user friendly device name and the installed Android OS version on the device.