2

On my Android Tablet I go to Settings -> About Device -> Status In this screen I find a serial number with a length of 11 characters. I would like to read this serial number with Java. Anyone an idea how to do that?

user1364471
  • 21
  • 1
  • 2

3 Answers3

2

Use

String x = Build.SERIAL

For more details check this out. This is the device serial number.

For MDN or MEID of the device depending on which radio the phone uses (GSM or CDMA), try

TelephonyManager tManager = (TelephonyManager)myActivity.getSystemService(Context.TELEPHONY_SERVICE);
String uid = tManager.getDeviceId();

and include the permission in the manifest file:

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
Tanuj Wadhwa
  • 2,025
  • 9
  • 35
  • 57
  • Build.SERIAL gives a number of 16 characters. This is not the one in Settings -> About Device -> Status which has 11 characters – user1364471 Jan 28 '14 at 10:28
2

Very old question, but perhaps the solution from dev here still helps:

public static String getManufacturerSerialNumber() {
String serial = null; 
try {
  Class<?> c = Class.forName("android.os.SystemProperties");
  Method get = c.getMethod("get", String.class, String.class);
  serial = (String) get.invoke(c, "ril.serialnumber", "unknown");
} catch (Exception ignored) {}
return serial;
}
Community
  • 1
  • 1
PdXY
  • 136
  • 1
  • 2
  • 12
0

Try this:

TextView tv = (TextView)findViewById(R.id.text);
String serial = Build.SERIAL;
tv.setText(serial);
japk
  • 619
  • 6
  • 10
  • Can't test this because I'm making a app using Phonegap, so my output is in html/javascript. The Build.SERIAL is the serial number you see when running "adb devices" – user1364471 Jan 28 '14 at 10:34