Java Code Examples for android.os.Build#HARDWARE

The following examples show how to use android.os.Build#HARDWARE . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: BlogDemo   File: FindEmulator.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean hasEmulatorBuild(Context context) {
    String BOARD = Build.BOARD; // The name of the underlying board, like "unknown".
    // This appears to occur often on real hardware... that's sad
    // String BOOTLOADER = android.os.Build.BOOTLOADER; // The system bootloader version number.
    String BRAND = Build.BRAND; // The brand (e.g., carrier) the software is customized for, if any.
    // "generic"
    String DEVICE = Build.DEVICE; // The name of the industrial design. "generic"
    String HARDWARE = Build.HARDWARE; // The name of the hardware (from the kernel command line or
    // /proc). "goldfish"
    String MODEL = Build.MODEL; // The end-user-visible name for the end product. "sdk"
    String PRODUCT = Build.PRODUCT; // The name of the overall product.
    if ((BOARD.compareTo("unknown") == 0) /* || (BOOTLOADER.compareTo("unknown") == 0) */
            || (BRAND.compareTo("generic") == 0) || (DEVICE.compareTo("generic") == 0)
            || (MODEL.compareTo("sdk") == 0) || (PRODUCT.compareTo("sdk") == 0)
            || (HARDWARE.compareTo("goldfish") == 0)) {
        return true;
    }
    return false;
}
 
Example 2
private static String getHandSetInfo() {
    String handSetInfo = "手机型号:" + Build.MODEL
            + "\n系统版本:" + Build.VERSION.RELEASE
            + "\n产品型号:" + Build.PRODUCT
            + "\n版本显示:" + Build.DISPLAY
            + "\n系统定制商:" + Build.BRAND
            + "\n设备参数:" + Build.DEVICE
            + "\n开发代号:" + Build.VERSION.CODENAME
            + "\nSDK版本号:" + Build.VERSION.SDK_INT
            + "\nCPU类型:" + Build.CPU_ABI
            + "\n硬件类型:" + Build.HARDWARE
            + "\n主机:" + Build.HOST
            + "\n生产ID:" + Build.ID
            + "\nROM制造商:" + Build.MANUFACTURER // 这行返回的是rom定制商的名称
            ;
    Log.e("tt",handSetInfo);
    return handSetInfo;
}
 
Example 3
public String getUserAgentString() {
    return "Android-Finsky/" + URLEncoder.encode(gsfVersionProvider.getVendingVersionString(true)).replace("+", "%20") + " ("
        + "api=3"
        + ",versionCode=" + gsfVersionProvider.getVendingVersionCode(true)
        + ",sdk=" + Build.VERSION.SDK_INT
        + ",device=" + Build.DEVICE
        + ",hardware=" + (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO ? Build.HARDWARE : Build.PRODUCT)
        + ",product=" + Build.PRODUCT
        + ",platformVersionRelease=" + Build.VERSION.RELEASE
        + ",model=" + URLEncoder.encode(Build.MODEL).replace("+", "%20")
        + ",buildId=" + Build.ID
        + ",isWideScreen=" + (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? "1" : "0")
        + ",supportedAbis=" + TextUtils.join(";", getPlatforms())
        + ")"
    ;
}
 
Example 4
public static String getDeviceInfo() {
    return "Build.PRODUCT: " + Build.PRODUCT + "\n" +
        "Build.MANUFACTURER: " + Build.MANUFACTURER + "\n" +
        "Build.BRAND: " + Build.BRAND + "\n" +
        "Build.DEVICE: " + Build.DEVICE + "\n" +
        "Build.MODEL: " + Build.MODEL + "\n" +
        "Build.HARDWARE: " + Build.HARDWARE + "\n" +
        "Build.FINGERPRINT: " + Build.FINGERPRINT;
}
 
Example 5
Source Project: IPTVFree   File: Utils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Get system information for bug report
 * @return String
 */
public static String getSystemInformation()
{
    return  "SDK: " + Build.VERSION.SDK_INT + "\n" +
            "RELEASE: " + Build.VERSION.RELEASE + "\n" +
            "DEVICE: " + Build.DEVICE + "\n" +
            "OS VERSION: " + System.getProperty("os.version") + "\n" +
            "OS NAME: " + System.getProperty("os.name") + "\n" +
            "MODEL: " + Build.MODEL + "\n" +
            "PRODUCT: " + Build.PRODUCT + "\n"+
            "BRAND: " + Build.BRAND + "\n" +
            "HARDWARE: " + Build.HARDWARE + "\n" +
            "BOARD: " + Build.BOARD + "\n";
}
 
Example 6
Source Project: ACDD   File: OpenAtlasInitializer.java    License: MIT License 5 votes vote down vote up
@SuppressLint({"DefaultLocale"})
private boolean verifyRuntime() {

    if ((Build.BRAND == null || !Build.BRAND.toLowerCase().contains("xiaomi") || Build.HARDWARE == null || !Build.HARDWARE.toLowerCase().contains("mt65")) && VERSION.SDK_INT >= 14) {
        return false;
    }
    return true;
}
 
Example 7
Source Project: Box   File: DeviceUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String getHardware() {
    return Build.HARDWARE;
}
 
Example 8
@Override
public boolean onOptionsItemSelected(MenuItem item) {
    int itemID = item.getItemId();
    switch (itemID) {
        case R.id.action_send:
          /*  if (IsUpdateAvailable) {

                new AlertDialog.Builder(this)
                        .setTitle("Update Available")
                        .setMessage("We've found an updated version of this app which may have fixed your issue. Kindly download it first & check the if issue occurs again or not.\n\nBy clicking \"OK\" button app will check for updates & will download it.")
                        .setCancelable(false)
                        .setPositiveButton("OK", (dialogInterface, i) -> {
                            new YTutils.CheckForUpdates(this,false).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                        })
                        .setNegativeButton("Cancel", (dialogInterface, i) -> finish())
                        .show();

                return true;
            }*/
            String message="";
            if (!editText.getText().toString().isEmpty()) {
                message = editText.getText().toString()+"\n\n";
            }
            message += "------ Device Info ------\nModel: "+ Build.MODEL+"\nProduct: "+ Build.PRODUCT+"\nHardware: "+Build.HARDWARE+"\n" +
                    "Android SDK: "+Build.VERSION.SDK_INT+"\n\n";
            if (sendLogs.isChecked())
            message += "------ StackTrace ------\n"+"<pre>"+crashDetails+"</pre>";
            try {
                PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
                emailIntent.setType("plain/text");
                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[] { "[email protected]" });
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"YTPlayer v"+ pInfo.versionName  +" Crash "+YTutils.getTodayDate());
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
                startActivity(emailIntent);
            } catch (PackageManager.NameNotFoundException e) {
                e.printStackTrace();
            }
           break;
    }
    return super.onOptionsItemSelected(item);
}
 
Example 9
private String collectInfo() {
    String info;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        info = "BRAND " + Build.BRAND + (char) 10 +
                "MODEL " + Build.MODEL + (char) 10 +
                "MANUFACTURER " + Build.MANUFACTURER + (char) 10 +
                "PRODUCT " + Build.PRODUCT + (char) 10 +
                "DEVICE " + Build.DEVICE + (char) 10 +
                "BOARD " + Build.BOARD + (char) 10 +
                "HARDWARE " + Build.HARDWARE + (char) 10 +
                "SUPPORTED_ABIS " + Arrays.toString(Build.SUPPORTED_ABIS) + (char) 10 +
                "SUPPORTED_32_BIT_ABIS " + Arrays.toString(Build.SUPPORTED_32_BIT_ABIS) + (char) 10 +
                "SUPPORTED_64_BIT_ABIS " + Arrays.toString(Build.SUPPORTED_64_BIT_ABIS) + (char) 10 +
                "SDK_INT " + Build.VERSION.SDK_INT + (char) 10 +
                "APP_VERSION_CODE " + BuildConfig.VERSION_CODE + (char) 10 +
                "APP_VERSION_NAME " + BuildConfig.VERSION_NAME + (char) 10 +
                "APP_PROC_VERSION " + TopFragment.appProcVersion + (char) 10 +
                "CAN_FILTER " + Util.canFilter(this) + (char) 10 +
                "APP_VERSION " + TopFragment.appVersion + (char) 10 +
                "DNSCRYPT_INTERNAL_VERSION " + TopFragment.DNSCryptVersion + (char) 10 +
                "TOR_INTERNAL_VERSION " + TopFragment.TorVersion + (char) 10 +
                "I2PD_INTERNAL_VERSION " + TopFragment.ITPDVersion + (char) 10 +
                "SIGN_VERSION " + TopFragment.appSign;
    } else {
        info = "BRAND " + Build.BRAND + (char) 10 +
                "MODEL " + Build.MODEL + (char) 10 +
                "MANUFACTURER " + Build.MANUFACTURER + (char) 10 +
                "PRODUCT " + Build.PRODUCT + (char) 10 +
                "DEVICE " + Build.DEVICE + (char) 10 +
                "BOARD " + Build.BOARD + (char) 10 +
                "HARDWARE " + Build.HARDWARE + (char) 10 +
                "SDK_INT " + Build.VERSION.SDK_INT + (char) 10 +
                "APP_VERSION_CODE " + BuildConfig.VERSION_CODE + (char) 10 +
                "APP_VERSION_NAME " + BuildConfig.VERSION_NAME + (char) 10 +
                "APP_PROC_VERSION " + TopFragment.appProcVersion + (char) 10 +
                "CAN_FILTER " + Util.canFilter(this) + (char) 10 +
                "APP_VERSION " + TopFragment.appVersion + (char) 10 +
                "DNSCRYPT_INTERNAL_VERSION " + TopFragment.DNSCryptVersion + (char) 10 +
                "TOR_INTERNAL_VERSION " + TopFragment.TorVersion + (char) 10 +
                "I2PD_INTERNAL_VERSION " + TopFragment.ITPDVersion + (char) 10 +
                "SIGN_VERSION " + TopFragment.appSign;
    }

    return info;
}
 
Example 10
Source Project: Box   File: DeviceUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String getHardware() {
    return Build.HARDWARE;
}
 
Example 11
Source Project: QPM   File: DeviceUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static String getHardware() {
	return Build.HARDWARE;
}
 
Example 12
@Override
public void uncaughtException(Thread t, Throwable e) {
    e.printStackTrace();
    String crashTime =
            new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.getDefault())
                    .format(new Date());
    String env =
            "########RuntimeEnviormentInormation#######\n" +
                    "crashTime = " + crashTime + "\n" +
                    "model = " + Build.MODEL + "\n" +
                    "android = " + Build.VERSION.RELEASE + "(" + Build.VERSION.SDK_INT + ")\n" +
                    "brand = " + Build.BRAND + "\n" +
                    "manufacturer = " + Build.MANUFACTURER + "\n" +
                    "board = " + Build.BOARD + "\n" +
                    "hardware = " + Build.HARDWARE + "\n" +
                    "device = " + Build.DEVICE + "\n" +
                    "version = " + getVersionName() + "(" + getVersionCode() + ")\n" +
                    "supportAbis = " + getSupportAbis() + "\n" +
                    "display = " + Build.DISPLAY + "\n";
    Writer writer = new StringWriter();
    PrintWriter printWriter = new PrintWriter(writer);
    e.printStackTrace(printWriter);
    Throwable cause = e.getCause();
    while (cause != null) {
        cause.printStackTrace(printWriter);
        cause = cause.getCause();
    }
    printWriter.close();
    String stack = "############ForceCloseCrashLog############\n" + writer.toString();
    String message = env + stack;
    try {
        String name = "error_log_" + crashTime + ".log";
        FileOutputStream fos =
                new FileOutputStream(new File(mContext.getExternalFilesDir("logs"), name));
        fos.write(message.getBytes());
        fos.close();
    } catch (IOException ex) {
        ex.printStackTrace();
    }

    Process.killProcess(Process.myPid());
    System.exit(1);
}
 
Example 13
public static String getHardware() {
    return Build.HARDWARE;
}
 
Example 14
public static String getHardware() {
    return Build.HARDWARE;
}
 
Example 15
public static String getHardware() {
    return Build.HARDWARE;
}
 
Example 16
Source Project: BaseProject   File: DeviceUtil.java    License: MIT License 4 votes vote down vote up
/** 硬件名称 */
public String getHardware() { return Build.HARDWARE; }
 
Example 17
Source Project: unity-ads-android   File: Device.java    License: Apache License 2.0 4 votes vote down vote up
public static String getHardware () {
	return Build.HARDWARE;
}
 
Example 18
Source Project: AndroidBasicProject   File: DeviceUtil.java    License: MIT License 4 votes vote down vote up
/** 硬件名称 */
public String getHardware(){ return Build.HARDWARE; }
 
Example 19
Source Project: Android-utils   File: DeviceUtils.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 获取硬件信息
 *
 * @return 硬件信息
 */
public static String getHardware() {
    return Build.HARDWARE;
}
 
Example 20
Source Project: DevUtils   File: DeviceUtils.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * 获取设备硬件名称, 一般和基板名称一样 (BOARD)
 * @return 设备硬件名称, 一般和基板名称一样 (BOARD)
 */
public static String getHardware() {
    return Build.HARDWARE;
}