Example usage for android.os Build BOARD

List of usage examples for android.os Build BOARD

Introduction

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

Prototype

String BOARD

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

Click Source Link

Document

The name of the underlying board, like "goldfish".

Usage

From source file:name.setup.dance.DanceStepApp.java

/** Called when the activity is first created. */
@Override//from   w  w  w .j  av  a2s. c om
public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "[ACTIVITY] onCreate");
    super.onCreate(savedInstanceState);

    //mStepValue = 0;
    mPaceValue = 0;

    setContentView(R.layout.main);

    mUtils = Utils.getInstance();

    String m_szDevIDShort = "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

    mUtils.DeviceName = m_szDevIDShort;

    Log.v(TAG, "ID: " + m_szDevIDShort);
    Log.v(TAG, "UTILS: " + mUtils.DeviceName);

    // user name
    mTextField = (EditText) findViewById(R.id.name_area);
    mTextField.setCursorVisible(false);

    if (!(mUtils.UserName == "My Name")) {

        mTextField.setText(mUtils.UserName);
    }
    mTextField.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click

            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            // only will trigger it if no physical keyboard is open
            mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT);

            mTextField.requestFocus();
            mTextField.setCursorVisible(true);
            mOkayButton.setVisibility(View.VISIBLE);

        }

    });

    // init okay Button
    mOkayButton = (Button) findViewById(R.id.okay_button);
    mOkayButton.setVisibility(View.INVISIBLE);
    mOkayButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0);

            mTextField.setCursorVisible(false);
            mTextField.clearFocus();
            mUtils.UserName = mTextField.getText().toString();

            // post name via HHTP
            new Thread(new Runnable() {
                public void run() {
                    if (mIsMetric) {
                        postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue);
                    } else {
                        postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f);
                    }
                }
            }).start();
            mOkayButton.setVisibility(View.INVISIBLE);

            // Post TOAST MESSAGE
            Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show();

        }

    });

    // init Score Button
    mScoreButton = (Button) findViewById(R.id.scoreButton);
    mScoreButton.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // Perform action on click
            String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time="
                    + System.currentTimeMillis();
            Intent i = new Intent(Intent.ACTION_VIEW);
            i.setData(Uri.parse(url));
            startActivity(i);
        }
    });

}

From source file:io.kristal.appinfos.AppInfosPlugin.java

private synchronized static String getUniqueId(Context context) {
    String uniqueID = null;/*from w  w w.j a  v  a  2 s .c  om*/
    SharedPreferences sharedPrefs = context.getSharedPreferences(PREF_UNIQUE_ID, Context.MODE_PRIVATE);
    uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null);
    if (uniqueID == null) {
        uniqueID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
        if (uniqueID == null || uniqueID.length() == 0 || "9774d56d682e549c".equals(uniqueID)) {
            // old version of reto meier
            //uniqueID = UUID.randomUUID().toString();
            uniqueID = "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
        }
        SharedPreferences.Editor editor = sharedPrefs.edit();
        editor.putString(PREF_UNIQUE_ID, uniqueID);
        editor.commit();
    }
    return uniqueID;
}

From source file:de.schildbach.wallet.util.CrashReporter.java

public static void appendDeviceInfo(final Appendable report, final Context context) throws IOException {
    final Resources res = context.getResources();
    final android.content.res.Configuration config = res.getConfiguration();
    final ActivityManager activityManager = (ActivityManager) context
            .getSystemService(Context.ACTIVITY_SERVICE);
    final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context
            .getSystemService(Context.DEVICE_POLICY_SERVICE);

    report.append("Device Model: " + Build.MODEL + "\n");
    report.append("Android Version: " + Build.VERSION.RELEASE + "\n");
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
        report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n");
    report.append("ABIs: ").append(Joiner.on(", ").skipNulls().join(Strings.emptyToNull(Build.CPU_ABI),
            Strings.emptyToNull(Build.CPU_ABI2))).append("\n");
    report.append("Board: " + Build.BOARD + "\n");
    report.append("Brand: " + Build.BRAND + "\n");
    report.append("Device: " + Build.DEVICE + "\n");
    report.append("Display: " + Build.DISPLAY + "\n");
    report.append("Finger Print: " + Build.FINGERPRINT + "\n");
    report.append("Host: " + Build.HOST + "\n");
    report.append("ID: " + Build.ID + "\n");
    report.append("Product: " + Build.PRODUCT + "\n");
    report.append("Tags: " + Build.TAGS + "\n");
    report.append("Time: " + Build.TIME + "\n");
    report.append("Type: " + Build.TYPE + "\n");
    report.append("User: " + Build.USER + "\n");
    report.append("Configuration: " + config + "\n");
    report.append("Screen Layout: size "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long "
            + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n");
    report.append("Display Metrics: " + res.getDisplayMetrics() + "\n");
    report.append("Memory Class: " + activityManager.getMemoryClass() + "/"
            + activityManager.getLargeMemoryClass()
            + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (low RAM device)" : "") + "\n");
    report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n");
    report.append("Bluetooth MAC: " + bluetoothMac() + "\n");
    report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ")
            .append(System.getProperty("java.vm.version")).append("\n");
}

From source file:org.cook_e.cook_e.BugReportActivity.java

/**
 * Gathers information about the device running the application and returns it as a JSONObject
 * @return information about the system/*from w w w.ja  va 2s .c  o m*/
 */
private JSONObject getSystemInformation() {
    final JSONObject json = new JSONObject();

    try {
        final JSONObject build = new JSONObject();
        build.put("version_name", BuildConfig.VERSION_NAME);
        build.put("version_code", BuildConfig.VERSION_CODE);
        build.put("build_type", BuildConfig.BUILD_TYPE);
        build.put("debug", BuildConfig.DEBUG);

        json.put("build", build);

        final JSONObject device = new JSONObject();
        device.put("board", Build.BOARD);
        device.put("bootloader", Build.BOOTLOADER);
        device.put("brand", Build.BRAND);
        device.put("device", Build.DEVICE);
        device.put("display", Build.DISPLAY);
        device.put("fingerprint", Build.FINGERPRINT);
        device.put("hardware", Build.HARDWARE);
        device.put("host", Build.HOST);
        device.put("id", Build.ID);
        device.put("manufacturer", Build.MANUFACTURER);
        device.put("model", Build.MODEL);
        device.put("product", Build.PRODUCT);
        device.put("radio", Build.getRadioVersion());
        device.put("serial", Build.SERIAL);
        device.put("tags", Build.TAGS);
        device.put("time", Build.TIME);
        device.put("type", Build.TYPE);
        device.put("user", Build.USER);

        json.put("device", device);
    } catch (JSONException e) {
        // Ignore
    }

    return json;
}

From source file:rus.cpuinfo.AndroidDepedentModel.DevInfo.java

@NonNull
private String getBoard() {
    return Build.BOARD != null ? Build.BOARD : StringUtils.EMPTY;
}

From source file:com.example.feedback.ActivityMain.java

/**
 * Get device information and save to application cache to send as attachment in feedback email.
 *///from   w  ww.ja v a  2  s.c om
public void getDeviceInfo() {
    try {
        dateTime = new Date();
        timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US);

        packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        appName = getApplicationContext().getString(packageInfo.applicationInfo.labelRes);
        appVersion = packageInfo.versionName;
        appCode = Integer.toString(packageInfo.versionCode);

        // Get application information.
        stringInfo = "date/time: " + timeFormat.format(dateTime) + "\n\n";
        stringInfo += "packageName: " + packageInfo.packageName + "\n";
        stringInfo += "packageCode: " + appCode + "\n";
        stringInfo += "packageVersion: " + appVersion + "\n";

        // Get network information.
        telephonyManager = ((TelephonyManager) getApplicationContext()
                .getSystemService(Context.TELEPHONY_SERVICE));

        if (!telephonyManager.getNetworkOperatorName().equals("")) {
            stringInfo += "operatorNetName: " + telephonyManager.getNetworkOperatorName() + "\n";
        } else if (!telephonyManager.getSimOperatorName().equals("")) {
            stringInfo += "operatorSimName: " + telephonyManager.getSimOperatorName() + "\n";
        }

        // Get device information.
        stringInfo += "Build.MODEL: " + Build.MODEL + "\n";
        stringInfo += "Build.BRAND: " + Build.BRAND + "\n";
        stringInfo += "Build.DEVICE: " + Build.DEVICE + "\n";
        stringInfo += "Build.PRODUCT: " + Build.PRODUCT + "\n";
        stringInfo += "Build.ID: " + Build.ID + "\n";
        stringInfo += "Build.TYPE: " + Build.TYPE + "\n";
        stringInfo += "Build.VERSION.SDK_INT: " + Build.VERSION.SDK_INT + "\n";
        stringInfo += "Build.VERSION.RELEASE: " + Build.VERSION.RELEASE + "\n";
        stringInfo += "Build.VERSION.INCREMENTAL: " + Build.VERSION.INCREMENTAL + "\n";
        stringInfo += "Build.VERSION.CODENAME: " + Build.VERSION.CODENAME + "\n";
        stringInfo += "Build.BOARD: " + Build.BOARD + "\n\n";

        // Get other application information.
        activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);
        runningProcesses = activityManager.getRunningAppProcesses();
        runningApplications = "";

        for (ActivityManager.RunningAppProcessInfo runningProcess : runningProcesses) {
            runningApplications += "\n  " + runningProcess.processName;
        }

        stringInfo += "Applications running:" + runningApplications;

        // Save information to cached file.
        fileOutput = new FileOutputStream(getCacheDir().getAbsolutePath() + "/deviceInfo.log");
        fileOutput.write(stringInfo.getBytes());
        fileOutput.close();
    } catch (Exception e) {
    }
}

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

/**
  * Generates a unique ID for the device.
  * /*  ww w . j a  v a  2 s  . c  o m*/
  * 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.framgia.android.emulator.EmulatorDetector.java

private boolean checkBasic() {
    boolean result = Build.FINGERPRINT.startsWith("generic") || Build.MODEL.contains("google_sdk")
            || Build.MODEL.toLowerCase().contains("droid4x") || Build.MODEL.contains("Emulator")
            || Build.MODEL.contains("Android SDK built for x86") || Build.MANUFACTURER.contains("Genymotion")
            || Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86")
            || Build.PRODUCT.equals("sdk") || Build.PRODUCT.equals("google_sdk")
            || Build.PRODUCT.equals("sdk_x86") || Build.PRODUCT.equals("vbox86p")
            || Build.BOARD.toLowerCase().contains("nox") || Build.BOOTLOADER.toLowerCase().contains("nox")
            || Build.HARDWARE.toLowerCase().contains("nox") || Build.PRODUCT.toLowerCase().contains("nox")
            || Build.SERIAL.toLowerCase().contains("nox");

    if (result)//from   w ww  . j  a v a  2s . c  om
        return true;
    result |= Build.BRAND.startsWith("generic") && Build.DEVICE.startsWith("generic");
    if (result)
        return true;
    result |= "google_sdk".equals(Build.PRODUCT);
    return result;
}

From source file:com.tdispatch.passenger.core.TDApplication.java

@SuppressWarnings("deprecation")
protected void initEnvInfo() {

    DisplayMetrics dm = getResources().getDisplayMetrics();

    String orientation = "???";
    switch (getResources().getConfiguration().orientation) {
    case Configuration.ORIENTATION_LANDSCAPE:
        orientation = "Landscape";
        break;/* ww w  .j av a  2s .c  o  m*/
    case Configuration.ORIENTATION_PORTRAIT:
        orientation = "Portrait";
        break;
    case Configuration.ORIENTATION_SQUARE:
        orientation = "Square";
        break;
    case Configuration.ORIENTATION_UNDEFINED:
        orientation = "Undef";
        break;
    default:
        orientation = "Unknown";
        break;
    }

    try {
        mEnvInfoJson.put("type", isTablet() ? "tablet" : "phone");
        mEnvInfoJson.put("build_manufacturer", Build.MANUFACTURER);
        mEnvInfoJson.put("build_model", Build.MODEL);
        mEnvInfoJson.put("build_board", Build.BOARD);
        mEnvInfoJson.put("build_device", Build.DEVICE);
        mEnvInfoJson.put("build_product", Build.PRODUCT);
        mEnvInfoJson.put("api", Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ")");
        mEnvInfoJson.put("screen",
                dm.widthPixels + "x" + dm.heightPixels + " (" + dm.densityDpi + "DPI) " + orientation);

        mEnvInfoJson.put("locale", Locale.getDefault());
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:de.ub0r.android.lib.DonationHelper.java

/**
 * Get MD5 hash of the IMEI (device id).
 * /*from w  w  w  . j  a  va2s .  c o m*/
 * @param context
 *            {@link Context}
 * @return MD5 hash of IMEI
 */
public static String getImeiHash(final Context context) {
    if (imeiHash == null) {
        // get imei
        TelephonyManager mTelephonyMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        final String did = mTelephonyMgr.getDeviceId();
        if (did != null) {
            imeiHash = Utils.md5(did);
        } else {
            imeiHash = Utils.md5(Build.BOARD + Build.BRAND + Build.PRODUCT + Build.DEVICE);
        }
    }
    return imeiHash;
}