Example usage for android.os Build BRAND

List of usage examples for android.os Build BRAND

Introduction

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

Prototype

String BRAND

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

Click Source Link

Document

The consumer-visible brand with which the product/hardware will be associated, if any.

Usage

From source file:Main.java

public static boolean isKindle() {
    return Build.BRAND.equalsIgnoreCase("amazon") || Build.MANUFACTURER.equalsIgnoreCase("amazon");
}

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.scsy150.util.OtherUtils.java

/**
 * @param context if null, use the default format
 *                (Mozilla/5.0 (Linux; U; Android %s) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 %sSafari/534.30).
 * @return/*from w w  w  .j  a  va  2 s .  com*/
 */
public static String getUserAgent() {
    String webUserAgent = "Android_%s_%s";
    String version = Build.VERSION.RELEASE;
    String name = Build.BRAND + " " + Build.MODEL;
    return String.format(webUserAgent, version, name);

    //        if (context != null) {
    //            try {
    //                Class sysResCls = Class.forName("com.android.internal.R$string");
    //                Field webUserAgentField = sysResCls.getDeclaredField("web_user_agent");
    //                Integer resId = (Integer) webUserAgentField.get(null);
    //                webUserAgent = context.getString(resId);
    //            } catch (Throwable ignored) {
    //            }
    //        }
    //        if (TextUtils.isEmpty(webUserAgent)) {
    //            webUserAgent = "Mozilla/5.0 (Linux; U; Android %s) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 %sSafari/533.1";
    //        }
    //
    //        Locale locale = Locale.getDefault();
    //        StringBuffer buffer = new StringBuffer();
    //        // Add version
    //        final String version = Build.VERSION.RELEASE;
    //        if (version.length() > 0) {
    //            buffer.append(version);
    //        } else {
    //            // default to "1.0"
    //            buffer.append("1.0");
    //        }
    //        buffer.append("; ");
    //        final String language = locale.getLanguage();
    //        if (language != null) {
    //            buffer.append(language.toLowerCase());
    //            final String country = locale.getCountry();
    //            if (country != null) {
    //                buffer.append("-");
    //                buffer.append(country.toLowerCase());
    //            }
    //        } else {
    //            // default to "en"
    //            buffer.append("en");
    //        }
    //        // add the model for the release build
    //        if ("REL".equals(Build.VERSION.CODENAME)) {
    //            final String model = Build.MODEL;
    //            if (model.length() > 0) {
    //                buffer.append("; ");
    //                buffer.append(model);
    //            }
    //        }
    //        final String id = Build.ID;
    //        if (id.length() > 0) {
    //            buffer.append(" Build/");
    //            buffer.append(id);
    //        }
    //        return String.format(webUserAgent, buffer, "Mobile ");
}

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

public static String getBrandInfo() {
    return String.format("Brand: %s", Build.BRAND);
}

From source file:com.ibm.mobilefirstplatform.clientsdk.android.security.identity.BaseDeviceIdentity.java

/**
 * Init the data using context//from   w  w w.j  av  a2 s.  com
 * @param context android application context
 */
public BaseDeviceIdentity(Context context) {
    try {
        put(ID, getDeviceUUID(context));
        put(OS, "android");
        put(OS_VERSION, Build.VERSION.RELEASE);
        put(BRAND, Build.BRAND);
        put(MODEL, Build.MODEL);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

/**
 * Gets the default vendor for this build.
 * 
 * @return the default vendor name
 */
private static String getDefaultVendor() {
    return Build.BRAND;
}

From source file:crow.util.Util.java

/**
 * ???//  w  ww.  j a  v a  2s  . 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);//from  ww  w.j  a  va2s. 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:at.wada811.android.library.demos.CrashExceptionHandler.java

/**
 * JSON??//from www .ja va2  s.co  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;
}

From source file:com.anysoftkeyboard.ui.dev.DeveloperUtils.java

public static String getSysInfo(@Nullable Context context) {
    StringBuilder sb = new StringBuilder();
    sb.append("BRAND:").append(Build.BRAND).append(NEW_LINE);
    sb.append("DEVICE:").append(Build.DEVICE).append(NEW_LINE);
    sb.append("Build ID:").append(Build.DISPLAY).append(NEW_LINE);
    sb.append("changelist number:").append(Build.ID).append("\n");
    sb.append("MODEL:").append(Build.MODEL).append(NEW_LINE);
    sb.append("PRODUCT:").append(Build.PRODUCT).append(NEW_LINE);
    sb.append("TAGS:").append(Build.TAGS).append(NEW_LINE);
    sb.append("VERSION.INCREMENTAL:").append(Build.VERSION.INCREMENTAL).append(NEW_LINE);
    sb.append("VERSION.RELEASE:").append(Build.VERSION.RELEASE).append(NEW_LINE);
    sb.append("VERSION.SDK_INT:").append(Build.VERSION.SDK_INT).append(NEW_LINE);
    if (context != null && context.getResources() != null
            && context.getResources().getConfiguration() != null) {
        Configuration configuration = context.getResources().getConfiguration();
        sb.append("Locale:").append(configuration.locale).append(NEW_LINE);
        sb.append("configuration:").append(configuration.toString()).append(NEW_LINE);
    }//from  ww  w.  j a  v  a  2s . c  o  m

    sb.append("That's all I know.");
    return sb.toString();
}