Skip to content

Instantly share code, notes, and snippets.


John Watkinson pents90

View GitHub Profile
ValCanBuild /
Created Jan 9, 2017
A way to get the CPU temperature from an android device by using the sys/class/thermal/temp command
public float getCpuTemp() {
Process p;
try {
p = Runtime.getRuntime().exec("cat sys/class/thermal/thermal_zone0/temp");
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = reader.readLine();
float temp = Float.parseFloat(line) / 1000.0f;