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 Comments

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

  2. Chaos7703 May 14, 2012 at 9:31 pm

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

     
    • James May 15, 2012 at 2:11 pm

      Sorry Chaos7703, that was a mistake.

       

Leave a Reply

Your email address will not be published. Required fields are marked *

 

 

 

Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.