Java Code Examples for android.os.Build#UNKNOWN

The following examples show how to use android.os.Build#UNKNOWN . 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 File: DeviceUtil.java    From OpenWeatherPlus-Android with Apache License 2.0 6 votes vote down vote up
/**
 * 获取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 File: RomUtil.java    From webrtc_android with 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 File: Rom.java    From imsdk-android with 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 File: RomUtil.java    From SimpleProject with 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 File: RomUtil.java    From AndroidPush with 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 File: RomUtil.java    From settingscompat with 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
Source File: OSUtils.java    From FriendCircle with GNU General Public License v3.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 8
Source File: DeviceUtil.java    From OpenWeatherPlus-Android with Apache License 2.0 5 votes vote down vote up
/**
 * 获取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 File: AppUtils.java    From CrashReporter with 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;
    }