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
/** * @param context//w w w. j a v a 2 s .co m * if null, use the default format (Mozilla/5.0 (Linux; U; * Android %s) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 * %sSafari/534.30). * @return */ public static String getUserAgent(Context context) { String webUserAgent = null; if (context != null) { try { Class<?> sysResCls = Class.forName("com.android.internal.R$string"); Field webUserAgentField = sysResCls.getDeclaredField("web_user_agent"); Integer resId = (Integer) webUserAgentField.get(null); webUserAgent = context.getString(resId); } catch (Throwable ignored) { } } if (TextUtils.isEmpty(webUserAgent)) { webUserAgent = "Mozilla/5.0 (Linux; U; Android %s) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 %sSafari/533.1"; } Locale locale = Locale.getDefault(); StringBuffer buffer = new StringBuffer(); // Add version final String version = Build.VERSION.RELEASE; if (version.length() > 0) { buffer.append(version); } else { // default to "1.0" buffer.append("1.0"); } buffer.append("; "); final String language = locale.getLanguage(); if (language != null) { buffer.append(language.toLowerCase()); final String country = locale.getCountry(); if (country != null) { buffer.append("-"); buffer.append(country.toLowerCase()); } } else { // default to "en" buffer.append("en"); } // add the model for the release build if ("REL".equals(Build.VERSION.CODENAME)) { final String model = Build.MODEL; if (model.length() > 0) { buffer.append("; "); buffer.append(model); } } final String id = Build.ID; if (id.length() > 0) { buffer.append(" Build/"); buffer.append(id); } return String.format(webUserAgent, buffer, "Mobile "); }
From source file:cc.softwarefactory.lokki.android.utilities.Utils.java
public static String getDeviceId() { return "35" + //we make this look like a valid IMEI Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + Build.SERIAL.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:com.manning.androidhacks.hack036.util.EnvironmentInfoUtil.java
public static String getModelInfo() { return String.format("Model: %s", Build.MODEL); }
From source file:com.amazonaws.mobileconnectors.cognitoidentityprovider.util.CognitoDeviceHelper.java
/** * Uses the Android class {@link android.os.build} to return the model of * the android device./*from ww w . jav a 2 s.c o m*/ * * @return Device model name, which is also the name of the device. */ public static String getDeviceName() { return Build.MODEL; }
From source file:org.pluginporo.honeywell.BarcodeScannerPlugin.java
@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if (action.equals("scan")) { this.pluginCallbackContext = callbackContext; if ((decodeManager == null) && (Build.MODEL.toLowerCase().contains("dolphin 70e".toLowerCase()))) { decodeManager = new DecodeManager(((CordovaActivity) this.cordova.getActivity()), ScanResultHandler);//from ww w . j a va 2 s . com } try { this.doScan(); return true; } catch (Exception e) { e.printStackTrace(); } } else if (action.equals("stop")) { callbackContext.success("stopped"); return true; } return false; }
From source file:com.ibm.mobilefirstplatform.clientsdk.android.security.identity.BaseDeviceIdentity.java
/** * Init the data using context//w w w. j a va 2s.c o m * @param context android application context */ public BaseDeviceIdentity(Context context) { try { put(ID, getDeviceUUID(context)); put(OS, "android"); put(OS_VERSION, Build.VERSION.RELEASE); put(BRAND, Build.BRAND); put(MODEL, Build.MODEL); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.technion.studybuddy.GCM.ServerUtilities.java
public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) return capitalize(model); else/*from w w w . ja v a2s . c o m*/ return capitalize(manufacturer) + " " + model; }
From source file:Main.java
/** * @param context if null, use the default format * (Mozilla/5.0 (Linux; U; Android %s) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 %sSafari/534.30). * @return//from ww w. j ava 2 s . com */ public static String getUserAgent(Context context) { String webUserAgent = null; if (context != null) { try { Class sysResCls = Class.forName("com.android.internal.R$string"); Field webUserAgentField = sysResCls.getDeclaredField("web_user_agent"); Integer resId = (Integer) webUserAgentField.get(null); webUserAgent = context.getString(resId); } catch (Throwable ignored) { } } if (TextUtils.isEmpty(webUserAgent)) { webUserAgent = "Mozilla/5.0 (Linux; U; Android %s) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 %sSafari/533.1"; } Locale locale = Locale.getDefault(); StringBuffer buffer = new StringBuffer(); // Add version final String version = Build.VERSION.RELEASE; if (version.length() > 0) { buffer.append(version); } else { // default to "1.0" buffer.append("1.0"); } buffer.append("; "); final String language = locale.getLanguage(); if (language != null) { buffer.append(language.toLowerCase()); final String country = locale.getCountry(); if (country != null) { buffer.append("-"); buffer.append(country.toLowerCase()); } } else { // default to "en" buffer.append("en"); } // add the model for the release build if ("REL".equals(Build.VERSION.CODENAME)) { final String model = Build.MODEL; if (model.length() > 0) { buffer.append("; "); buffer.append(model); } } final String id = Build.ID; if (id.length() > 0) { buffer.append(" Build/"); buffer.append(id); } return String.format(webUserAgent, buffer, "Mobile "); }
From source file:titutorial.sysinfo.SysteminfoModule.java
@Kroll.method public String getInfo() { JSONObject obj = new JSONObject(); try {//from ww w.j av a2s . co m obj.put("OS_VERSION", android.os.Build.VERSION.RELEASE.toString()); obj.put("API_LEVEL", (android.os.Build.VERSION.SDK_INT + "").toString()); obj.put("MANUFACTURER", android.os.Build.MANUFACTURER.toString()); obj.put("MODEL", android.os.Build.MODEL.toString()); obj.put("RAM(kb)", getTotalRAM().toString()); obj.put("RAM(mb)", getTotalRAMinMb().toString()); obj.put("ABI", Build.CPU_ABI.toString()); obj.put("PROCESSOR", getCPUInfo().toString()); } catch (Exception e) { } return obj.toString(); }
From source file:com.nerderylabs.android.nerdalert.util.ProfileUtil.java
public static String getDeviceName() { String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; return manufacturer + " " + model; }