How to find the device ID or Serial Number of an android device?

By | July 11, 2011

Here is a simple API to find the device ID of an android device.
There are many ways to get the device ID in android

    String serial_no = null;

    try {
        Class<?> c = Class.forName("android.os.SystemProperties");
        Method get = c.getMethod("get", String.class);
        serial_no = (String) get.invoke(c, "ro.serialno");
       System.out.println("Device serial ID : " + serial_no);
    } catch (Exception e) {
        System.out.println("Some error occured : " + e.getMessage());
    }

Note : Try this in a real device, then only you will get the device ID.
Also put this permission in the AndroidManifest file

<uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>

3 thoughts on “How to find the device ID or Serial Number of an android device?

  1. Pingback: How to find the device ID or Serial Number of an android device … | Serial Bitwa Warszawska

  2. Chaos7703

    Why is this listed under AIR/Flex? This is Java, not ActionScript.

    Reply

Leave a Reply

Your email address will not be published.