2

i'm newbie

I'm using samsung tab P3100 (ICS 4.04).on menus setting->about device->status, i can got the serial number of device.How to get this serial number value programmatically ?

please help me...

android.os.Build.Serial <> Serial Number

Note : Serial number <> IMEI <> android_id <> mac address

Paijo RX
  • 21
  • 2
  • 4
  • Take a look at http://stackoverflow.com/a/5626213/724514. Note the blog link and the comments about issues with serial number on 2.2 devices. – bobnoble Nov 09 '12 at 03:16
  • did you get the exact answer?i am also in trouble with this samsung tab 2?Please help me – KIRAN K J May 31 '13 at 05:30

2 Answers2

0
 public class Utility {
Context context;

public AdParameters(Context context) {
    this.context = context;
    metrics = context.getResources().getDisplayMetrics();
}

public String getDeviceName() {
    return android.os.Build.MODEL;
}

public String getIMEI() {

    TelephonyManager telephonyManager = (TelephonyManager) context
            .getSystemService(Context.TELEPHONY_SERVICE);
    return telephonyManager.getDeviceId();

}



public String getMobielNo() {

    TelephonyManager tm = (TelephonyManager) context
            .getSystemService(context.TELEPHONY_SERVICE);
    return tm.getLine1Number();

}

}

Android: How to programmatically access the device serial number shown in the AVD manager (API Version 8). Have a look at this link.

Community
  • 1
  • 1
Raghunandan
  • 132,755
  • 26
  • 225
  • 256
0

You can use the getprop command on the adb shell and check yourself that which of the files contains the correct Serial number.Many times the serial number is located on different files and code has to be device specific.

Foe samung Tab 3 you can use the following code:

try {

    Class<?> c = Class.forName("android.os.SystemProperties");

    Method get = c.getMethod("get", String.class, String.class);

    serialnum = (String) (get.invoke(c, "sys.serialnumber", "unknown"));

} catch (Exception ignored) {

    serialnum = "unknown";

}
Himanshu Khandelwal
  • 5,341
  • 1
  • 17
  • 7