Fetching device data through ADB on Windows

2019-06-03 11:03发布

问题:

If I have Android phone connected via USB, how do I know the commands I can send via USB to get Information like

  1. core temperature of the device,
  2. version of android,
  3. power consumption details, etc.

Can I then use ADB logs, command to interact with Android mobile. Please may i know the process apart from commands if I have to send commands via ADB.

回答1:

To get information from an android device, you can always use the following tools.

Use utilities like dumpsys or getprop.
Query from /sys/ or /proc/.

Eventually all utilities, fetch information from /proc or /sys, so you can directly investigate into these.

You could use dumpsys tools to get information:

  1. Core temperature of the device I'm not sure, what exactly do you mean by core temperature of the device.

    1. Temperature of Device: Note

      $ adb shell cat /sys/class/thermal/thermal_zone0/temp
      37
      
    2. Temperature of Battery:

       $ adb shell cat /sys/class/power_supply/battery/device/power_supply/battery/temp
       285  
      

      or

      $ adb shell dumpsys battery                                
      Current Battery Service state:
      AC powered: false
      USB powered: true
      Wireless powered: false
      status: 2
      health: 2
      present: true
      level: 15
      scale: 100
      voltage: 3768
      current now: -357254
      temperature: 285    # <---- Temparature.
      technology: Li-ion
      
  2. Version of android

    $ getprop ro.build.version.release  
    4.4.4   #<--- Android Kitkat 4.4.4
    
  3. I'm not completely sure how you can get exact information: You could start with,

    $ adb shell dumpsys power 
    POWER MANAGER (dumpsys power)
    
    Power Manager State:
            ....
    

Note: Results on a Linux System.

$ acpi -t      # <--- apci power utility/tool.
Thermal 0: ok, 29.8 degrees C
Thermal 1: ok, 27.8 degrees C

$ cat /sys/class/thermal/thermal_zone0/temp 
27800

I want this to be executed every 50 ms ?
You could write a script with above commands, that queries every 50ms.

Set-up ADB on Windows ?
A quick Google search should help you out.
Set Up Android ADB On Windows


To make proper use of Dumpsys,
See What's the Android ADB shell "dumpsys" tool and what are its benefits?
http://android-test-tw.blogspot.in/2012/10/dumpsys-information-android-open-source.html

Getprop : Android ADB commands to get the device properties

I hope this should give you a good start.



回答2:

You will get the Android device properties using getprop command.

Please go through this blog .Here I am listing some of the major ADB commands. Feel free to ask doubts regarding these commands.



标签: adb