Get hardware serial number of Android device Get hardware serial number of Android device android android

Get hardware serial number of Android device


The solution is very simple:

Class<?> c = Class.forName("android.os.SystemProperties");Method get = c.getMethod("get", String.class, String.class);serialNumber = (String) get.invoke(c, "sys.serialnumber", "Error");if(serialNumber.equals("Error")) {    serialNumber = (String) get.invoke(c, "ril.serialnumber", "Error");}

This will get you the serial number of most samsung devices. I use the "sys.serialnumber" value to get the serial number of my SM-T210 (Galaxy Tab 3) and SM-T230 (Galaxy Tab 4) tablets, but probably works with a lot more Samsung tablets. The "ril.serialnumber" is to get the value on my Samsung GT-I8550L (Galaxy Win).

I hope this helps.