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 boolean hasSmartBar() {
    try {//from www.  j  a v a  2  s  .co m
        // Invoke Build.hasSmartBar()
        final Method method = Build.class.getMethod("hasSmartBar");
        return ((Boolean) method.invoke(null)).booleanValue();
    } catch (final Exception e) {
    }
    // Detect by Build.DEVICE
    if (isDeviceWithSmartBar(Build.DEVICE))
        return true;
    return false;
}

From source file:Main.java

public static String getDeviceId(Context context) {
    // IMEI, if present
    TelephonyManager telephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imei = telephonyMgr.getDeviceId(); // Requires READ_PHONE_STATE
    if (imei != null)
        return imei;

    String devId = "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 devId;
}

From source file:Main.java

public static String getDeviceType() {
    String device = Build.DEVICE;
    if (TextUtils.isEmpty(device))
        device = "Android";
    return device;
}

From source file:Main.java

public static String collectStats(CharSequence flattenedParams) {
    StringBuilder result = new StringBuilder(1000);

    result.append("BOARD=").append(Build.BOARD).append('\n');
    result.append("BRAND=").append(Build.BRAND).append('\n');
    result.append("CPU_ABI=").append(Build.CPU_ABI).append('\n');
    result.append("DEVICE=").append(Build.DEVICE).append('\n');
    result.append("DISPLAY=").append(Build.DISPLAY).append('\n');
    result.append("FINGERPRINT=").append(Build.FINGERPRINT).append('\n');
    result.append("HOST=").append(Build.HOST).append('\n');
    result.append("ID=").append(Build.ID).append('\n');
    result.append("MANUFACTURER=").append(Build.MANUFACTURER).append('\n');
    result.append("MODEL=").append(Build.MODEL).append('\n');
    result.append("PRODUCT=").append(Build.PRODUCT).append('\n');
    result.append("TAGS=").append(Build.TAGS).append('\n');
    result.append("TIME=").append(Build.TIME).append('\n');
    result.append("TYPE=").append(Build.TYPE).append('\n');
    result.append("USER=").append(Build.USER).append('\n');
    result.append("VERSION.CODENAME=").append(Build.VERSION.CODENAME).append('\n');
    result.append("VERSION.INCREMENTAL=").append(Build.VERSION.INCREMENTAL).append('\n');
    result.append("VERSION.RELEASE=").append(Build.VERSION.RELEASE).append('\n');
    result.append("VERSION.SDK_INT=").append(Build.VERSION.SDK_INT).append('\n');

    if (flattenedParams != null) {
        String[] params = SEMICOLON.split(flattenedParams);
        Arrays.sort(params);/* ww w . j  av a  2s  . co  m*/
        for (String param : params) {
            result.append(param).append('\n');
        }
    }

    return result.toString();
}

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
}

From source file:com.manning.androidhacks.hack036.util.EnvironmentInfoUtil.java

public static String getDeviceInfo() {
    return String.format("Device: %s", Build.DEVICE);
}

From source file:crow.util.Util.java

/**
 * ???/* w ww  .  jav a2s .c o m*/
 * 
 * @return true ? false ?
 */
public static boolean isEmulator() {
    return ("unknown".equals(Build.BOARD)) && ("generic".equals(Build.DEVICE))
            && ("generic".equals(Build.BRAND));
}

From source file:org.weyoung.xianbicycle.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_layout);
    ButterKnife.bind(this);

    String format = String.format(Locale.US, getString(R.string.version), BuildConfig.VERSION_NAME);
    version.setText(format);/*w  w  w  . j  a  v  a  2  s  .c o  m*/

    initAllFragment();

    StatConfig.setDebugEnable(true);
    StatService.trackCustomEvent(this, "welcome",
            String.format(Locale.US, "%s %s %s", Build.BRAND, Build.DEVICE, Build.VERSION.CODENAME));
}

From source file:com.grizzly.analytics.Logging.BaseAnalyticsLog.java

/**
 * Constructor method. Based in the analytics strategy, selects the most fitting storage strategy.
 * It also sets the ID value of the class to the current count of logged events.
 *//*from   w w w . j a  v a2s. c  om*/
public BaseAnalyticsLog() {

    super(String.class);

    SimpleDateFormat sd = new SimpleDateFormat("yyyy/MM/dd HH:mm:ssz");
    this.idField = sd.format(Calendar.getInstance(Locale.getDefault()).getTime()) + "-" + Build.MANUFACTURER
            + " " + Build.DEVICE;
    resetStrategy();

}

From source file:at.wada811.android.library.demos.CrashExceptionHandler.java

/**
 * JSON??//from w  w w . ja v  a  2s .c  o  m
 * 
 * @return
 * @throws JSONException
 */
private static JSONObject getBuildInfo() {
    JSONObject json = new JSONObject();
    try {
        json.put("BRAND", Build.BRAND); // ?????(docomo)
        json.put("MODEL", Build.MODEL); // ????(SO-01C)
        json.put("DEVICE", Build.DEVICE); // ???(SO-01C)
        json.put("MANUFACTURER", Build.MANUFACTURER); // ??(Sony Ericsson)
        json.put("VERSION.SDK_INT", Build.VERSION.SDK_INT); // ??(10)
        json.put("VERSION.RELEASE", Build.VERSION.RELEASE); // ????(2.3.4)
    } catch (JSONException e) {
        e.printStackTrace();
    }
    return json;
}