List of usage examples for android.os Build MODEL
String MODEL
To view the source code for android.os Build MODEL.
Click Source Link
From source file:Main.java
/** * Generates a pseudo-unique ID according to http://www.pocketmagic.net/android-unique-device-id/ *///ww w .ja v a 2s. co m static String generateDeviceId() { return "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 }
From source file:Main.java
/** * Get unique device info./* w ww .j av a 2 s. c o m*/ * * @param context application context. * @return returns a json object of the device, manufacturer, build version, and a unique id. */ public static JSONObject getDeviceInfo(Context context) { JSONObject deviceInfo = new JSONObject(); try { deviceInfo.put("device", Build.MODEL); deviceInfo.put("manufacturer", Build.MANUFACTURER); deviceInfo.put("android", android.os.Build.VERSION.SDK); TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); String tmDevice = tm.getDeviceId(); String androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); String serial = null; if (Build.VERSION.SDK_INT > Build.VERSION_CODES.FROYO) serial = Build.SERIAL; if (androidId != null) deviceInfo.put("uid", androidId); else if (serial != null) deviceInfo.put("uid", serial); else if (tmDevice != null) deviceInfo.put("uid", tmDevice); deviceInfo.put("carrier", tm.getNetworkOperatorName()); } catch (JSONException e) { e.printStackTrace(); } return deviceInfo; }
From source file:Main.java
public static String getDeviceInfos(Context context) { Map<String, String> infos = new LinkedHashMap<>(); DisplayMetrics dm = context.getResources().getDisplayMetrics(); int densityDpi = dm.densityDpi; infos.put("API Level", String.valueOf(Build.VERSION.SDK_INT)); infos.put("OS Version", Build.VERSION.RELEASE); infos.put("Model", Build.MODEL); infos.put("Manufacturer", Build.MANUFACTURER); infos.put("Brand", Build.BRAND); infos.put("Device / Product", Build.DEVICE + " / " + Build.PRODUCT); infos.put("Kernel-Version", System.getProperty("os.version")); StringBuilder sb = new StringBuilder(); sb.append("<table class=\"table table-striped\">"); sb.append("<tbody>"); for (Map.Entry<String, String> deviceInfo : infos.entrySet()) { sb.append("<tr><th>"); sb.append(deviceInfo.getKey());/*from w w w . j a v a 2 s . c om*/ sb.append("</th><td>"); sb.append(deviceInfo.getValue()); sb.append("</td></tr>"); } sb.append("<tbody>"); sb.append("</table>"); return sb.toString(); }
From source file:Main.java
public static boolean isEmulator() { return Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk"); }
From source file:Main.java
public static String getDeviceName() { String model = Build.MODEL; return model; }
From source file:Main.java
private static String getDeviceModel(Context context) { return Build.MODEL; }
From source file:Main.java
public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { String temp = capitalize(model); temp = temp.replaceAll(" ", ""); return temp; } else {/*ww w .ja va 2 s .c om*/ String temp = capitalize(manufacturer) + " " + model; temp = temp.replaceAll(" ", ""); return temp; } }
From source file:Main.java
public static boolean deviceIsBlacklistedForOpenSLESUsage() { List<String> blackListedModels = Arrays.asList(BLACKLISTED_OPEN_SL_ES_MODELS); return blackListedModels.contains(Build.MODEL); }
From source file:Main.java
/** * Returns true if and only enabling adaptive playback is unsafe. On some * device / os combinations, enabling it causes decoded frames to be * unusable. For example, the S3 on 4.4.2 returns black and white, tiled * frames when this is enabled./*from w ww . ja va 2 s . c om*/ */ private static boolean isAdaptivePlaybackBlacklisted(String mime) { if (!mime.equals("video/avc") && !mime.equals("video/avc1")) { return false; } if (!Build.VERSION.RELEASE.equals("4.4.2")) { return false; } if (!Build.MANUFACTURER.toLowerCase(Locale.getDefault()).equals("samsung")) { return false; } return Build.MODEL.startsWith("GT-I9300") || // S3 (I9300 / I9300I) Build.MODEL.startsWith("SCH-I535"); // S3 }
From source file:Main.java
public static boolean isAmazonFire() { return Build.MODEL.startsWith("AFT"); }