Example usage for android.os Build DISPLAY

List of usage examples for android.os Build DISPLAY

Introduction

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

Prototype

String DISPLAY

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

Click Source Link

Document

A build ID string meant for displaying to the user

Usage

From source file:Main.java

public static String getOsBuildNumber() {
    return Build.DISPLAY;
}

From source file:Main.java

public static String getUniqueId() {
    String m_szDevIDShort = "35" + //we make this look like a valid IMEI
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.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;/*w w  w.j a va2 s  .c  om*/
    return m_szDevIDShort;
}

From source file:Main.java

/**
 * Generates a pseudo-unique ID according to http://www.pocketmagic.net/android-unique-device-id/
 *//*from w w  w  .  j ava  2  s  . co  m*/
static String generateDeviceId() {
    return "35" + //we make this look like a valid IMEI
            Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.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
}

From source file:Main.java

public static String getDisplayVersion() {
    return Build.DISPLAY;
}

From source file:Main.java

public static String getSystemInfo() {
    String a = "BOARD" + Build.BOARD;
    a += "BRAND" + Build.BRAND;
    a += "CPU_ABI" + Build.CPU_ABI;
    a += "DEVICE" + Build.DEVICE;
    a += "DISPLAY" + Build.DISPLAY;
    a += "FINGERPRINT" + Build.FINGERPRINT;
    a += "HOST" + Build.HOST;
    a += "ID" + Build.ID;
    a += "MANUFACTURER" + Build.MANUFACTURER;
    a += "MODEL" + Build.MODEL;
    a += "PRODUCT" + Build.PRODUCT;
    a += "TAGS" + Build.TAGS;
    a += "TYPE" + Build.TYPE;
    a += "USER" + Build.USER;
    return a;// w w  w.  j a v  a 2s.  c om

}

From source file:Main.java

public static String getBuildInfo(Context context) {
    // get app version info
    String appVersion = "";
    PackageInfo pInfo;/*w  ww  .  j  a  va  2s  . co  m*/
    try {
        pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
        appVersion = pInfo.versionName + " (" + pInfo.versionCode + ")\n";
    } catch (NameNotFoundException e) {
    }

    String board = "Board: " + Build.BOARD + "\n";
    String bootloader = "Bootloader: " + Build.BOOTLOADER + "\n";
    String brand = "Brand: " + Build.BRAND + "\n";
    String device = "Device: " + Build.DEVICE + "\n";
    String display = "Display: " + Build.DISPLAY + "\n";
    String product = "Product: " + Build.PRODUCT + "\n";
    String model = "Model: " + Build.MODEL + "\n";
    String manufacturer = "Manufacturer: " + Build.MANUFACTURER + "\n";

    return appVersion + board + bootloader + brand + device + display + product + model + manufacturer;
}

From source file:Main.java

public static String getDeviceId(Context context) {
    try {//from   w  ww .  j a v  a 2s .co m
        TelephonyManager TelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String szImei = TelephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE
        return szImei;
    } catch (Exception e) {
        // Oh well
    }
    try {
        String m_szDevIDShort = "35" + //we make this look like a valid IMEI
                Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.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
        return m_szDevIDShort;
    } catch (Exception e) {
        // Oh well
    }
    return "tempid" + getRandom().nextInt();
}

From source file:Main.java

public static String getScreenInfos(Context context) {
    Map<String, String> infos = new LinkedHashMap<>();

    DisplayMetrics dm = context.getResources().getDisplayMetrics();
    int densityDpi = dm.densityDpi;
    float density = dm.density;
    int height = dm.heightPixels;
    int width = dm.widthPixels;

    infos.put("Screen", String.valueOf(width + " x " + height));
    infos.put("Density / DPI", String.valueOf(densityDpi) + " / " + getHumanReadableDpi(density));
    infos.put("Current orientation", getHumanReadableOrientation(context));
    infos.put("Display", Build.DISPLAY);

    StringBuilder sb = new StringBuilder();

    sb.append("<table class=\"table table-striped\">");
    sb.append("<tbody>");

    for (Map.Entry<String, String> deviceInfo : infos.entrySet()) {
        sb.append("<tr><th>");
        sb.append(deviceInfo.getKey());//from  w  w  w .  j  a v  a2 s.c om
        sb.append("</th><td>");
        sb.append(deviceInfo.getValue());
        sb.append("</td></tr>");
    }
    sb.append("<tbody>");
    sb.append("</table>");

    return sb.toString();
}

From source file:Main.java

public static final String getOblyDevicesID(Context mContext) {

    String m_szImei = "";
    try {/*from   ww w . j  av a  2s  .  c  om*/
        TelephonyManager TelephonyMgr = null;
        TelephonyMgr = (TelephonyManager) mContext.getSystemService(Activity.TELEPHONY_SERVICE);
        m_szImei = TelephonyMgr.getDeviceId();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    String m_szDevIDShort = null;
    try {
        m_szDevIDShort = "35" + //we make this look like a valid IMEI

                Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.CPU_ABI.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
    } catch (Exception ex) {
        ex.printStackTrace();
    }

    String m_szAndroidID = "";
    try {
        m_szAndroidID = "";
        Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ANDROID_ID);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    String m_szWLANMAC = "";
    try {
        WifiManager wm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
        m_szWLANMAC = wm.getConnectionInfo().getMacAddress();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    String m_szBTMAC = null;
    try {
        BluetoothAdapter m_BluetoothAdapter = null; // Local Bluetooth adapter
        m_BluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        m_szBTMAC = m_BluetoothAdapter.getAddress();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    String m_szLongID = m_szImei + m_szDevIDShort + m_szAndroidID + m_szWLANMAC + m_szBTMAC;
    // compute md5
    MessageDigest m = null;
    try {
        m = MessageDigest.getInstance("MD5");
    } catch (NoSuchAlgorithmException e) {
        e.printStackTrace();
    }
    m.update(m_szLongID.getBytes(), 0, m_szLongID.length());
    // get md5 bytes
    byte p_md5Data[] = m.digest();
    // create a hex string
    String m_szUniqueID = new String();
    for (int i = 0; i < p_md5Data.length; i++) {
        int b = (0xFF & p_md5Data[i]);
        // if it is a single digit, make sure it have 0 in front (proper padding)
        if (b <= 0xF)
            m_szUniqueID += "0";
        // add number to string
        m_szUniqueID += Integer.toHexString(b);
    } // hex string to uppercase
    m_szUniqueID = m_szUniqueID.toUpperCase();

    return m_szUniqueID;
}

From source file:Main.java

public static int getVersion(Context context) {

    int ver = -1;
    String str = Build.DISPLAY;
    if (TextUtils.isEmpty(str) || !str.toLowerCase().contains("flyme")) {
        return -1;
    }//from  w  w  w  .  j av  a 2s. c o  m
    try {
        String[] split = str.replaceAll(" ", "").toLowerCase().split("\\.");
        if (split.length < 2) {
            return -1;
        }
        try {
            return (Integer.valueOf(split[0].substring(split[0].length() - 1)).intValue() * 10)
                    + Integer.valueOf(split[1].substring(0, 1)).intValue();
        } catch (Exception e) {

            ver = -1;
            return ver;
        }
    } catch (Exception e2) {
        return ver;
    }
}