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:library.artaris.cn.library.utils.SystemUtils.java

/**
 * ??/*w  w  w  .jav  a2 s. co  m*/
 * @return
 */
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:om.sstvencoder.MainActivity.java

private void showErrorMessage(final String title, final String shortText, final String longText) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(title);//  w w  w . ja  v a  2 s .  c  o m
    builder.setMessage(shortText);
    builder.setNeutralButton(getString(R.string.btn_ok), null);
    builder.setPositiveButton(getString(R.string.btn_send_email), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String device = Build.MANUFACTURER + ", " + Build.BRAND + ", " + Build.MODEL + ", "
                    + Build.VERSION.RELEASE;
            String text = longText + "\n\n" + BuildConfig.VERSION_NAME + ", " + device;
            Intent intent = Utility.createEmailIntent(getString(R.string.email_subject), text);
            startActivity(Intent.createChooser(intent, getString(R.string.chooser_title)));
        }
    });
    builder.show();
}

From source file:com.appbackr.android.tracker.Tracker.java

/**
  * Generates a unique ID for the device.
  * /* w ww .  j  a va 2 s . c om*/
  * This function obtain the Unique ID from the phone. The Unique ID consist of
  *    Build.BOARD + Build.BRAND + Build.CPU_ABI
  *    + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST
  *    + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT
  *    + Build.TAGS + Build.TYPE + Build.USER;
  *    + IMEI (GSM) or MEID/ESN (CDMA)
  *    + Android-assigned id
  * 
  * The Android ID may be changed everytime the user perform Factory Reset
  * I heard that IMEI values might not be unique because phone factory
  * might reuse IMEI values to cut cost.
  * 
  * While the ID might be different from the same device, but resetting of the
  * Android phone should not occur that often. The values should be close 
  * enough.
  *
  * @param c android application contact 
  * @return unique ID as md5 hash generated of available parameters from device and cell phone service provider
  */
 private static String getUDID(Context c) {

     // Get some of the hardware information
     String buildParams = Build.BOARD + Build.BRAND + Build.CPU_ABI + Build.DEVICE + Build.DISPLAY
             + Build.FINGERPRINT + Build.HOST + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT
             + Build.TAGS + Build.TYPE + Build.USER;

     // Requires READ_PHONE_STATE
     TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE);

     // gets the imei (GSM) or MEID/ESN (CDMA)
     String imei = tm.getDeviceId();

     // gets the android-assigned id
     String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID);

     // concatenate the string
     String fullHash = buildParams.toString() + imei + androidId;

     return md5(fullHash);
 }

From source file:com.bosco.noticeboard.RegistrationIntentService.java

/**
 * Persist registration to third-party servers.
 *
 * Modify this method to associate the user's GCM registration token with any server-side account
 * maintained by your application./*from w ww .j av a 2 s  .  c o m*/
 *
 * @param token The new token.
 */
private String sendRegistrationToServer(String token) {
    //TODO Sync channels from server to mobile after reinstalling app
    // get device IMEI number
    TelephonyManager mngr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    String IMEI = "UNKNOWN";
    String deviceInfo = "UNKNOWN";
    try {
        IMEI = mngr.getDeviceId();
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("SDK", Build.VERSION.SDK_INT);
        jsonObject.put("RELEASE", Build.VERSION.RELEASE);
        jsonObject.put("MODEL", android.os.Build.MODEL);
        jsonObject.put("BRAND", Build.BRAND);
        jsonObject.put("MANUFACTURER", Build.MANUFACTURER);
        Log.d(TAG, "DEVICE : " + jsonObject.toString());
        deviceInfo = jsonObject.toString();
    } catch (Exception e) {
        Log.d(TAG, "Unable to device info");
    }

    String url = NoticeBoardPreferences.URL_REGISTER_TOKEN;
    Map<String, String> payload = new HashMap<String, String>();
    payload.put(NoticeBoardPreferences.KEY_TOKEN, token);
    payload.put(NoticeBoardPreferences.KEY_IMEI, IMEI);
    payload.put(NoticeBoardPreferences.KEY_DEVICE, deviceInfo);

    NetworkHandler nh = new NetworkHandler(payload, url);
    return nh.callServer();

}

From source file:com.catchnotes.api.CatchAPI.java

/** 
 * Constructor./*from  w w  w.ja v a  2s . c om*/
 * 
 * @param appName The name of your application.
 * @param context Android context.
 */
public CatchAPI(String appName, Context context) {
    source = appName;
    mContext = context;
    String version = "x.xx";

    try {
        PackageInfo info = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0);
        version = info.versionName;
    } catch (Exception e) {
    }

    StringBuilder locale = new StringBuilder(5);
    String language = Locale.getDefault().getLanguage();

    if (language != null) {
        locale.append(language);
        String country = Locale.getDefault().getCountry();

        if (country != null) {
            locale.append('-');
            locale.append(country);
        }
    }

    userAgent = appName + '/' + version + " (Android; " + Build.VERSION.RELEASE + "; " + Build.BRAND + "; "
            + Build.MODEL + "; " + locale.toString() + ')';

    try {
        if (Integer.parseInt(Build.VERSION.SDK) >= Build.VERSION_CODES.ECLAIR_0_1) {
            // We can use Time & TimeFormatException on Android 2.0.1
            // (API level 6) or greater. It crashes the VM otherwise.
            timestamper = new Time();
        }
    } catch (Exception e) {
    }
}

From source file:com.benlinskey.greekreference.lexicon.LexiconDetailActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (KeyEvent.KEYCODE_MENU == keyCode && Build.BRAND.equalsIgnoreCase("LGE")) {
        return true;
    }//  w ww  .j  av a2  s  .com
    return super.onKeyDown(keyCode, event);
}

From source file:com.github.javiersantos.piracychecker.LibraryUtils.java

/**
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions
 * and limitations under the License./*from  w  w w  .  j ava2  s.  c  o m*/
 *
 * Copyright (C) 2013, Vladislav Gingo Skoumal (http://www.skoumal.net)
 */
static boolean isInEmulator(boolean deepCheck) {
    int ratingCheckEmulator = 0;

    if (Build.PRODUCT.contains("sdk") || Build.PRODUCT.contains("Andy")
            || Build.PRODUCT.contains("ttVM_Hdragon") || Build.PRODUCT.contains("google_sdk")
            || Build.PRODUCT.contains("Droid4X") || Build.PRODUCT.contains("nox")
            || Build.PRODUCT.contains("sdk_x86") || Build.PRODUCT.contains("sdk_google")
            || Build.PRODUCT.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MANUFACTURER.equals("unknown") || Build.MANUFACTURER.equals("Genymotion")
            || Build.MANUFACTURER.contains("Andy") || Build.MANUFACTURER.contains("MIT")
            || Build.MANUFACTURER.contains("nox") || Build.MANUFACTURER.contains("TiantianVM")) {
        ratingCheckEmulator++;
    }

    if (Build.BRAND.equals("generic") || Build.BRAND.equals("generic_x86") || Build.BRAND.equals("TTVM")
            || Build.BRAND.contains("Andy")) {
        ratingCheckEmulator++;
    }

    if (Build.DEVICE.contains("generic") || Build.DEVICE.contains("generic_x86")
            || Build.DEVICE.contains("Andy") || Build.DEVICE.contains("ttVM_Hdragon")
            || Build.DEVICE.contains("Droid4X") || Build.DEVICE.contains("nox")
            || Build.DEVICE.contains("generic_x86_64") || Build.DEVICE.contains("vbox86p")) {
        ratingCheckEmulator++;
    }

    if (Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk") || Build.MODEL.contains("Droid4X")
            || Build.MODEL.contains("TiantianVM") || Build.MODEL.contains("Andy")
            || Build.MODEL.equals("Android SDK built for x86_64")
            || Build.MODEL.equals("Android SDK built for x86")) {
        ratingCheckEmulator++;
    }

    if (Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.HARDWARE.contains("nox")
            || Build.HARDWARE.contains("ttVM_x86")) {
        ratingCheckEmulator++;
    }

    if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("generic/sdk/generic")
            || Build.FINGERPRINT.contains("generic_x86/sdk_x86/generic_x86")
            || Build.FINGERPRINT.contains("Andy") || Build.FINGERPRINT.contains("ttVM_Hdragon")
            || Build.FINGERPRINT.contains("generic_x86_64")
            || Build.FINGERPRINT.contains("generic/google_sdk/generic") || Build.FINGERPRINT.contains("vbox86p")
            || Build.FINGERPRINT.contains("generic/vbox86p/vbox86p")) {
        ratingCheckEmulator++;
    }

    if (deepCheck) {
        try {
            String opengl = GLES20.glGetString(GLES20.GL_RENDERER);
            if (opengl != null) {
                if (opengl.contains("Bluestacks") || opengl.contains("Translator"))
                    ratingCheckEmulator += 10;
            }
        } catch (Exception ignored) {
        }

        try {
            File sharedFolder = new File(Environment.getExternalStorageDirectory().toString()
                    + File.separatorChar + "windows" + File.separatorChar + "BstSharedFolder");
            if (sharedFolder.exists())
                ratingCheckEmulator += 10;
        } catch (Exception ignored) {
        }
    }

    return ratingCheckEmulator > 3;
}

From source file:com.benlinskey.greekreference.lexicon.LexiconDetailActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    if (KeyEvent.KEYCODE_MENU == keyCode && Build.BRAND.equalsIgnoreCase("LGE")) {
        openOptionsMenu();/*w  w w.  jav a  2s  .c om*/
        return true;
    }
    return super.onKeyUp(keyCode, event);
}

From source file:com.triarc.sync.LogCollector.java

private String collectPhoneInfo() {
    return String.format("Carrier:%s\nModel:%s\nFirmware:%s\n", Build.BRAND,
            //            Build.DEVICE, 
            //            Build.BOARD, 
            //            Build.DISPLAY, 
            Build.MODEL,//from   ww  w.  j a  v  a2s  . c  o m
            //            Build.PRODUCT, 
            Build.VERSION.RELEASE);
}

From source file:net.granoeste.scaffold.app.ScaffoldActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // WTF: LGE Bug... NullPointerException (@PhoneWindow:onKeyUpPanel:1002) {main} - Stack Overflow http://stackoverflow.com/questions/26833242/nullpointerexception-phonewindowonkeyuppanel1002-main
    if (keyCode == KeyEvent.KEYCODE_MENU && "LGE".equalsIgnoreCase(Build.BRAND)) {
        return true;
    }/*from w ww .j  a v a 2s. c  om*/
    return super.onKeyDown(keyCode, event);
}