Example usage for android.os Build SERIAL

List of usage examples for android.os Build SERIAL

Introduction

In this page you can find the example usage for android.os Build SERIAL.

Prototype

String SERIAL

To view the source code for android.os Build SERIAL.

Click Source Link

Document

A hardware serial number, if available.

Usage

From source file:Main.java

public static String getLocalSN() {
    return Build.SERIAL;
}

From source file:Main.java

public static String getSerialNumber() {
    return Build.SERIAL;
}

From source file:Main.java

public static String getDeviceSerial() {
    return "Build.SERIAL: " + Build.SERIAL + "\n" + "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n"
            + "Build.MODEL: " + Build.MODEL + "\n";
}

From source file:Main.java

public static String getBuildSerialId() {
    String deviceId = null;// w w  w .  j a  v  a2 s .c o  m
    if (Build.VERSION.SDK_INT > VERSION_CODES.GINGERBREAD) {
        deviceId = Build.SERIAL;
    }
    return deviceId;
}

From source file:Main.java

/**
 * This method retrieve Serial number of the device,
 * Only if android.os.Build.VERSION.SDK is greater or equal android API Level 9
 *    //ww w  . j a  va  2  s .  c  o  m
 * @return    Serial Number address
 */
public static String getSerialNumber() {
    String serialNum = "";
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
        serialNum = Build.SERIAL;
    }
    return serialNum;
}

From source file:Main.java

/**
 * Get device unique identify./*from  www. j a  v a2 s . c  om*/
 *
 * @param context
 */
public static String getDeviceId(Context context) {
    String androidId = Secure.getString(context.getContentResolver(), Secure.ANDROID_ID);
    // If android_id is null , then use serial number.
    if (androidId == null) {
        androidId = Build.SERIAL;
    }
    return androidId;
}

From source file:Main.java

public static String getSerial() {
    return Build.SERIAL;
}

From source file:Main.java

private static String getSerialNumber() {
    // This section uses org.cyanogemod.hw, which is not included in this app
    //        try {
    //            if (SerialNumber.isSupported()) {
    //                return SerialNumber.getSerialNumber();
    //            }
    //        } catch (NoClassDefFoundError e) {
    //            // Hardware abstraction framework not installed; fall through
    //        }//from w  ww .  j a va 2s .c  o m

    return Build.SERIAL;
}

From source file:Main.java

/**
 * Get unique device info.// w ww . j a  va2  s .c  o  m
 *
 * @param context application context.
 * @return returns a json object of the device, manufacturer, build version, and a unique id.
 */
public static JSONObject getDeviceInfo(Context context) {
    JSONObject deviceInfo = new JSONObject();
    try {
        deviceInfo.put("device", Build.MODEL);
        deviceInfo.put("manufacturer", Build.MANUFACTURER);
        deviceInfo.put("android", android.os.Build.VERSION.SDK);

        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

        String tmDevice = tm.getDeviceId();
        String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
        String serial = null;
        if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO)
            serial = Build.SERIAL;
        if (androidId != null)
            deviceInfo.put("uid", androidId);
        else if (serial != null)
            deviceInfo.put("uid", serial);
        else if (tmDevice != null)
            deviceInfo.put("uid", tmDevice);
        deviceInfo.put("carrier", tm.getNetworkOperatorName());
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return deviceInfo;
}

From source file:cc.softwarefactory.lokki.android.utilities.Utils.java

public static String getDeviceId() {

    return "35" + //we make this look like a valid IMEI
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.SERIAL.length() % 10
            + Build.DEVICE.length() % 10 + Build.DISPLAY.length() % 10 + Build.HOST.length() % 10
            + Build.ID.length() % 10 + Build.MANUFACTURER.length() % 10 + Build.MODEL.length() % 10
            + Build.PRODUCT.length() % 10 + Build.TAGS.length() % 10 + Build.TYPE.length() % 10
            + Build.USER.length() % 10; //13 digits
}