Example usage for android.os Build PRODUCT

List of usage examples for android.os Build PRODUCT

Introduction

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

Prototype

String PRODUCT

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

Click Source Link

Document

The name of the overall product.

Usage

From source file:Main.java

public static void logDeviceInfo(String tag) {
    Log.d(tag,//  ww w .jav 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

/** Information about the current build, taken from system properties. */
public static void logDeviceInfo(String tag) {
    Log.d(tag,/*from   ww  w. ja va 2s.com*/
            "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/
 *///from  w  w  w.  java  2  s . c o  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 getProduct() {
    return Build.PRODUCT;
}

From source file:Main.java

public static boolean isEmulator() {
    String product = Build.PRODUCT;
    return (product != null && (product.equals("sdk") || product.contains("_sdk") || product.contains("sdk_")));
}

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());/*  w  w w  . j  a  v 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 Boolean isTestMode(Context context) {
    return "sdk".equals(Build.PRODUCT) || "google_sdk".equals(Build.PRODUCT);
}

From source file:Main.java

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

From source file:Main.java

/**
 * Return pseudo unique ID/*from  w w  w . java 2  s  .  c o  m*/
 * @return ID
 */
public static String getUniquePsuedoID() {
    // If all else fails, if the user does have lower than API 9 (lower
    // than Gingerbread), has reset their phone or 'Secure.ANDROID_ID'
    // returns 'null', then simply the ID returned will be solely based
    // off their Android device information. This is where the collisions
    // can happen.
    // Thanks http://www.pocketmagic.net/?p=1662!
    // Try not to use DISPLAY, HOST or ID - these items could change.
    // If there are collisions, there will be overlapping data
    String m_szDevIDShort = "35" + (Build.BOARD.length() % 10) + (Build.BRAND.length() % 10)
            + (Build.CPU_ABI.length() % 10) + (Build.DEVICE.length() % 10) + (Build.MANUFACTURER.length() % 10)
            + (Build.MODEL.length() % 10) + (Build.PRODUCT.length() % 10);

    // Thanks to @Roman SL!
    // http://stackoverflow.com/a/4789483/950427
    // Only devices with API >= 9 have android.os.Build.SERIAL
    // http://developer.android.com/reference/android/os/Build.html#SERIAL
    // If a user upgrades software or roots their phone, there will be a duplicate entry
    String serial = null;
    try {
        serial = android.os.Build.class.getField("SERIAL").get(null).toString();

        // Go ahead and return the serial for api => 9
        return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
    } catch (Exception e) {
        // String needs to be initialized
        serial = "serial"; // some value
    }

    // Thanks @Joe!
    // http://stackoverflow.com/a/2853253/950427
    // Finally, combine the values we have found by using the UUID class to create a unique identifier
    return new UUID(m_szDevIDShort.hashCode(), serial.hashCode()).toString();
}