List of usage examples for android.os Build USER
String USER
To view the source code for android.os Build USER.
Click Source Link
From source file:es.javocsoft.android.lib.toolbox.ToolBox.java
/** * Generates a unique device id using the device * "serial" property if is available. If not, a bunch * of device properties will be used to get a reliable * unique string key for the device./*from w ww . ja v a 2 s. c o m*/ * * If there is an error in UUID generation null is * returned. * * @return The unique UUID or nul in case of error. */ private static UUID generateUniqueDeviceUUIDId() { UUID uuid = null; try { //We generate a unique id String serial = null; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) { serial = Build.SERIAL; uuid = UUID.nameUUIDFromBytes(serial.getBytes("utf8")); } else { //This bunch of data should be enough to "ensure" the //uniqueness. String m_szDevIDAlterbative = "35" + //To 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 uuid = UUID.nameUUIDFromBytes(m_szDevIDAlterbative.getBytes("utf8")); } } catch (UnsupportedEncodingException e) { Log.e(TAG, "UnsupportedEncodingException (" + e.getMessage() + ").", e); } return uuid; }