Java Code Examples for android.os.Build#UNKNOWN

The following examples show how to use android.os.Build#UNKNOWN . 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
/**
 * 获取IMEI
 */
@SuppressLint("HardwareIds")
private static String getDeviceId(Context context) {
    try {
        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        if (ActivityCompat.checkSelfPermission(context, Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
            return Build.UNKNOWN;
        } else if (telephonyManager != null) {
            String imei = telephonyManager.getDeviceId();
            if (TextUtils.isEmpty(imei)) {
                return Build.UNKNOWN;
            }
            return "B" + imei;
        } else {
            return Build.UNKNOWN;
        }
    } catch (Exception e) {
        return Build.UNKNOWN;
    }
}
 
Example 2
Source Project: webrtc_android   File: RomUtil.java    License: MIT License 6 votes vote down vote up
public static boolean check(String rom) {
    if (sName != null) {
        return sName.equals(rom);
    }

    if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
        sName = ROM_MIUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
        sName = ROM_EMUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
        sName = ROM_OPPO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
        sName = ROM_VIVO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
        sName = ROM_SMARTISAN;
    } else {
        sVersion = Build.DISPLAY;
        if (sVersion.toUpperCase().contains(ROM_FLYME)) {
            sName = ROM_FLYME;
        } else {
            sVersion = Build.UNKNOWN;
            sName = Build.MANUFACTURER.toUpperCase();
        }
    }
    return sName.equals(rom);
}
 
Example 3
Source Project: imsdk-android   File: Rom.java    License: MIT License 6 votes vote down vote up
public static boolean check(String rom) {
    if (sName != null) {
        return sName.equals(rom);
    }

    if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
        sName = ROM_MIUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
        sName = ROM_EMUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
        sName = ROM_OPPO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
        sName = ROM_VIVO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
        sName = ROM_SMARTISAN;
    } else {
        sVersion = Build.DISPLAY;
        if (sVersion.toUpperCase().contains(ROM_FLYME)) {
            sName = ROM_FLYME;
        } else {
            sVersion = Build.UNKNOWN;
            sName = Build.MANUFACTURER.toUpperCase();
        }
    }
    return sName.equals(rom);
}
 
Example 4
Source Project: SimpleProject   File: RomUtil.java    License: MIT License 6 votes vote down vote up
public static boolean check(String rom) {
	if (sName != null) {
		return sName.equals(rom);
	}

	if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
		sName = ROM_MIUI;
	} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
		sName = ROM_EMUI;
	} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
		sName = ROM_OPPO;
	} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
		sName = ROM_VIVO;
	} else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
		sName = ROM_SMARTISAN;
	} else {
		sVersion = Build.DISPLAY;
		if (sVersion.toUpperCase().contains(ROM_FLYME)) {
			sName = ROM_FLYME;
		} else {
			sVersion = Build.UNKNOWN;
			sName = Build.MANUFACTURER.toUpperCase();
		}
	}
	return sName.equals(rom);
}
 
Example 5
Source Project: AndroidPush   File: RomUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean check(String rom) {
    if (sName != null) {
        return sName.equals(rom);
    }

    if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
        sName = ROM_MIUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
        sName = ROM_EMUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
        sName = ROM_OPPO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
        sName = ROM_VIVO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
        sName = ROM_SMARTISAN;
    } else {
        sVersion = Build.DISPLAY;
        if (sVersion.toUpperCase().contains(ROM_FLYME)) {
            sName = ROM_FLYME;
        } else {
            sVersion = Build.UNKNOWN;
            sName = Build.MANUFACTURER.toUpperCase();
        }
    }
    return sName.equals(rom);
}
 
Example 6
Source Project: settingscompat   File: RomUtil.java    License: Apache License 2.0 6 votes vote down vote up
public static boolean check(String rom) {
    if (sName != null) {
        return sName.equals(rom);
    }

    if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
        sName = ROM_MIUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))){
        sName = ROM_EMUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))){
        sName = ROM_OPPO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))){
        sName = ROM_VIVO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))){
        sName = ROM_SMARTISAN;
    } else {
        sVersion = Build.DISPLAY;
        if (sVersion.toUpperCase().contains(ROM_FLYME)) {
            sName = ROM_FLYME;
        } else {
            sVersion = Build.UNKNOWN;
            sName = Build.MANUFACTURER.toUpperCase();
        }
    }
    return sName.equals(rom);
}
 
Example 7
public static boolean check(String rom) {
    if (sName != null) {
        return sName.equals(rom);
    }

    if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_MIUI))) {
        sName = ROM_MIUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_EMUI))) {
        sName = ROM_EMUI;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_OPPO))) {
        sName = ROM_OPPO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_VIVO))) {
        sName = ROM_VIVO;
    } else if (!TextUtils.isEmpty(sVersion = getProp(KEY_VERSION_SMARTISAN))) {
        sName = ROM_SMARTISAN;
    } else {
        sVersion = Build.DISPLAY;
        if (sVersion.toUpperCase().contains(ROM_FLYME)) {
            sName = ROM_FLYME;
        } else {
            sVersion = Build.UNKNOWN;
            sName = Build.MANUFACTURER.toUpperCase();
        }
    }
    return sName.equals(rom);
}
 
Example 8
/**
 * 获取Android_ID
 */
public static String getAndroid_Id(Context context) {
    try {
        String androidId = Settings.System.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
        return object2String(androidId, Build.UNKNOWN);
    } catch (Exception e) {
        return Build.UNKNOWN;
    }
}
 
Example 9
Source Project: CrashReporter   File: AppUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static String getDeviceDetails(Context context) {

        return "Device Information\n"
                + "\nDEVICE.ID : " + getDeviceId(context)
                + "\nUSER.ID : " + getUserIdentity(context)
                + "\nAPP.VERSION : " + getAppVersion(context)
                + "\nLAUNCHER.APP : " + getCurrentLauncherApp(context)
                + "\nTIMEZONE : " + timeZone()
                + "\nVERSION.RELEASE : " + Build.VERSION.RELEASE
                + "\nVERSION.INCREMENTAL : " + Build.VERSION.INCREMENTAL
                + "\nVERSION.SDK.NUMBER : " + Build.VERSION.SDK_INT
                + "\nBOARD : " + Build.BOARD
                + "\nBOOTLOADER : " + Build.BOOTLOADER
                + "\nBRAND : " + Build.BRAND
                + "\nCPU_ABI : " + Build.CPU_ABI
                + "\nCPU_ABI2 : " + Build.CPU_ABI2
                + "\nDISPLAY : " + Build.DISPLAY
                + "\nFINGERPRINT : " + Build.FINGERPRINT
                + "\nHARDWARE : " + Build.HARDWARE
                + "\nHOST : " + Build.HOST
                + "\nID : " + Build.ID
                + "\nMANUFACTURER : " + Build.MANUFACTURER
                + "\nMODEL : " + Build.MODEL
                + "\nPRODUCT : " + Build.PRODUCT
                + "\nSERIAL : " + Build.SERIAL
                + "\nTAGS : " + Build.TAGS
                + "\nTIME : " + Build.TIME
                + "\nTYPE : " + Build.TYPE
                + "\nUNKNOWN : " + Build.UNKNOWN
                + "\nUSER : " + Build.USER;
    }