Example usage for android.os Build DEVICE

List of usage examples for android.os Build DEVICE

Introduction

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

Prototype

String DEVICE

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

Click Source Link

Document

The name of the industrial design.

Usage

From source file:Main.java

public static void logDeviceInfo(String tag) {
    Log.d(tag,//  ww w. j  a v a 2  s.c  o m
            "Android SDK: " + Build.VERSION.SDK_INT + ", " + "Release: " + Build.VERSION.RELEASE + ", "
                    + "Brand: " + Build.BRAND + ", " + "Device: " + Build.DEVICE + ", " + "Id: " + Build.ID
                    + ", " + "Hardware: " + Build.HARDWARE + ", " + "Manufacturer: " + Build.MANUFACTURER + ", "
                    + "Model: " + Build.MODEL + ", " + "Product: " + Build.PRODUCT);
}

From source file:Main.java

public static boolean hasSmartBar() {
    try {/*from   w w w.  j a va 2  s  .c  o m*/
        Method method = Class.forName("android.os.Build").getMethod("hasSmartBar");
        return ((Boolean) method.invoke(null)).booleanValue();
    } catch (Exception e) {
    }

    if (Build.DEVICE.equals("mx2") || Build.DEVICE.equals("mx3")) {
        return true;
    } else if (Build.DEVICE.equals("mx") || Build.DEVICE.equals("m9")) {
        return false;
    }

    return false;
}

From source file:Main.java

/** Information about the current build, taken from system properties. */
public static void logDeviceInfo(String tag) {
    Log.d(tag,/* w ww. j a v  a 2s . co m*/
            "Android SDK: " + Build.VERSION.SDK_INT + ", " + "Release: " + Build.VERSION.RELEASE + ", "
                    + "Brand: " + Build.BRAND + ", " + "Device: " + Build.DEVICE + ", " + "Id: " + Build.ID
                    + ", " + "Hardware: " + Build.HARDWARE + ", " + "Manufacturer: " + Build.MANUFACTURER + ", "
                    + "Model: " + Build.MODEL + ", " + "Product: " + Build.PRODUCT);
}

From source file:Main.java

/**
 * Generates a pseudo-unique ID according to http://www.pocketmagic.net/android-unique-device-id/
 *//* w ww . j  ava  2s.com*/
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

static boolean isTheUpdateForMe(File path) {

    JarFile jar;/*w ww . j  a  va2  s . c o m*/
    try {
        jar = new JarFile(path);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        return false;
    }

    ZipEntry entry = jar.getEntry("system/build.prop");
    final String myDevice = "ro.product.device=" + Build.DEVICE;
    boolean finded = false;

    if (entry != null) {
        try {
            InputStreamReader bi = new InputStreamReader(jar.getInputStream(entry));

            BufferedReader br = new BufferedReader(bi);

            String line;
            Pattern p = Pattern.compile(myDevice);
            do {
                line = br.readLine();
                if (line == null) {
                    break;
                }

                Matcher m = p.matcher(line);
                if (m.find()) {
                    finded = true;
                    break;
                }
            } while (true);

            bi.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
        }
    }
    try {
        jar.close();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return finded;
}

From source file:Main.java

public static String getDevice() {
    return Build.DEVICE;
}

From source file:Main.java

public static boolean isRunningOnEmulator() {
    return Build.BRAND.contains("generic") || Build.DEVICE.contains("generic") || Build.PRODUCT.contains("sdk")
            || Build.HARDWARE.contains("goldfish") || Build.MANUFACTURER.contains("Genymotion")
            || Build.PRODUCT.contains("vbox86p") || Build.DEVICE.contains("vbox86p")
            || Build.HARDWARE.contains("vbox86");
}

From source file:Main.java

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

    DisplayMetrics dm = context.getResources().getDisplayMetrics();
    int densityDpi = dm.densityDpi;

    infos.put("API Level", String.valueOf(Build.VERSION.SDK_INT));
    infos.put("OS Version", Build.VERSION.RELEASE);
    infos.put("Model", Build.MODEL);
    infos.put("Manufacturer", Build.MANUFACTURER);
    infos.put("Brand", Build.BRAND);
    infos.put("Device / Product", Build.DEVICE + " / " + Build.PRODUCT);
    infos.put("Kernel-Version", System.getProperty("os.version"));

    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 av  a 2  s  . co  m*/
        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 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;//from  www . ja  v  a  2  s  . co  m

}

From source file:Main.java

public static String getBuildInfo(Context context) {
    // get app version info
    String appVersion = "";
    PackageInfo pInfo;// w  w  w  .ja v a  2 s.c  om
    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;
}