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:com.prey.net.PreyWebServices.java
/** * Register a new device for a given API_KEY, needed just after obtain the * new API_KEY.//from w w w . ja v a2 s. c om * * @throws PreyException */ private PreyHttpResponse registerNewDevice(Context ctx, String api_key, String deviceType) throws PreyException { PreyConfig preyConfig = PreyConfig.getPreyConfig(ctx); String model = Build.MODEL; String vendor = "Google"; if (!PreyConfig.getPreyConfig(ctx).isCupcakeOrAbove()) vendor = AboveCupcakeSupport.getDeviceVendor(); HashMap<String, String> parameters = new HashMap<String, String>(); parameters.put("api_key", api_key); parameters.put("title", vendor + " " + model); parameters.put("device_type", deviceType); parameters.put("os", "Android"); parameters.put("os_version", Build.VERSION.RELEASE); parameters.put("referer_device_id", ""); parameters.put("plan", "free"); parameters.put("activation_phrase", preyConfig.getSmsToRun()); parameters.put("deactivation_phrase", preyConfig.getSmsToStop()); parameters.put("model_name", model); parameters.put("vendor_name", vendor); parameters = increaseData(ctx, parameters); TelephonyManager mTelephonyMgr = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); //String imsi = mTelephonyMgr.getSubscriberId(); String imei = mTelephonyMgr.getDeviceId(); parameters.put("physical_address", imei); PreyHttpResponse response = null; try { String apiv2 = FileConfigReader.getInstance(ctx).getApiV2(); String url = PreyConfig.getPreyConfig(ctx).getPreyUrl().concat(apiv2).concat("devices.json"); PreyLogger.d("url:" + url); response = PreyRestHttpClient.getInstance(ctx).post(url, parameters); PreyLogger.d("response:" + response.getStatusLine() + " " + response.getResponseAsString()); // No more devices allowed if ((response.getStatusLine().getStatusCode() == 302) || (response.getStatusLine().getStatusCode() == 422) || (response.getStatusLine().getStatusCode() == 403)) { throw new NoMoreDevicesAllowedException( ctx.getText(R.string.set_old_user_no_more_devices_text).toString()); } if (response.getStatusLine().getStatusCode() > 299) { throw new PreyException(ctx.getString(R.string.error_cant_add_this_device, "[" + response.getStatusLine().getStatusCode() + "]")); } } catch (IOException e) { throw new PreyException(ctx.getText(R.string.error_communication_exception).toString(), e); } return response; }
From source file:fr.simon.marquis.secretcodes.util.ExportContentProvider.java
private void saveJsonFile(ArrayList<SecretCode> secretCodes) { try {//w ww. ja va2s . co m JSONObject jsonObject = new JSONObject(); jsonObject.put(DEVICE_MANUFACTURER, Build.MANUFACTURER); jsonObject.put(DEVICE_MODEL, Build.MODEL); jsonObject.put(DEVICE_CODE_NAME, Build.DEVICE); jsonObject.put(DEVICE_LOCALE, Locale.getDefault().getDisplayName()); jsonObject.put(ANDROID_VERSION, String.valueOf(Build.VERSION.RELEASE)); JSONArray jsonArray = new JSONArray(); for (SecretCode secretCode : secretCodes) { jsonArray.put(secretCode.toJSON()); } jsonObject.put(SECRET_CODES, jsonArray); FileOutputStream openFileOutput = getContext().openFileOutput(JSON_FILE_NAME, Context.MODE_PRIVATE); openFileOutput.write(jsonObject.toString(4).getBytes()); openFileOutput.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } }
From source file:com.androchill.call411.MainActivity.java
private Phone getHardwareSpecs() { ActivityManager activityManager = (ActivityManager) getSystemService(ACTIVITY_SERVICE); PhoneBuilder pb = new PhoneBuilder(); pb.setModelNumber(Build.MODEL); pb.setManufacturer(Build.MANUFACTURER); Process p = null;// www .j a v a 2s . com String board_platform = "No data available"; try { p = new ProcessBuilder("/system/bin/getprop", "ro.chipname").redirectErrorStream(true).start(); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = br.readLine()) != null) { board_platform = line; } p.destroy(); } catch (IOException e) { e.printStackTrace(); board_platform = "No data available"; } pb.setProcessor(board_platform); ActivityManager.MemoryInfo mInfo = new ActivityManager.MemoryInfo(); activityManager.getMemoryInfo(mInfo); pb.setRam((int) (mInfo.totalMem / 1048576L)); pb.setBatteryCapacity(getBatteryCapacity()); pb.setTalkTime(-1); pb.setDimensions("No data available"); WindowManager mWindowManager = getWindowManager(); Display mDisplay = mWindowManager.getDefaultDisplay(); Point mPoint = new Point(); mDisplay.getSize(mPoint); pb.setScreenResolution(mPoint.x + " x " + mPoint.y + " pixels"); DisplayMetrics mDisplayMetrics = new DisplayMetrics(); mDisplay.getMetrics(mDisplayMetrics); int mDensity = mDisplayMetrics.densityDpi; pb.setScreenSize( Math.sqrt(Math.pow(mPoint.x / (double) mDensity, 2) + Math.pow(mPoint.y / (double) mDensity, 2))); Camera camera = Camera.open(0); android.hardware.Camera.Parameters params = camera.getParameters(); List sizes = params.getSupportedPictureSizes(); Camera.Size result = null; ArrayList<Integer> arrayListForWidth = new ArrayList<Integer>(); ArrayList<Integer> arrayListForHeight = new ArrayList<Integer>(); for (int i = 0; i < sizes.size(); i++) { result = (Camera.Size) sizes.get(i); arrayListForWidth.add(result.width); arrayListForHeight.add(result.height); } if (arrayListForWidth.size() != 0 && arrayListForHeight.size() != 0) { pb.setCameraMegapixels( Collections.max(arrayListForHeight) * Collections.max(arrayListForWidth) / (double) 1000000); } else { pb.setCameraMegapixels(-1); } camera.release(); pb.setPrice(-1); pb.setWeight(-1); pb.setSystem("Android " + Build.VERSION.RELEASE); StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath()); StatFs statInternal = new StatFs(Environment.getRootDirectory().getAbsolutePath()); double storageSize = ((stat.getBlockSizeLong() * stat.getBlockCountLong()) + (statInternal.getBlockSizeLong() * statInternal.getBlockCountLong())) / 1073741824L; pb.setStorageOptions(storageSize + " GB"); TelephonyManager telephonyManager = ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)); String operatorName = telephonyManager.getNetworkOperatorName(); if (operatorName.length() == 0) operatorName = "No data available"; pb.setCarrier(operatorName); pb.setNetworkFrequencies("No data available"); pb.setImage(null); return pb.createPhone(); }
From source file:com.triarc.sync.LogCollector.java
private String collectPhoneInfo() { return String.format("Carrier:%s\nModel:%s\nFirmware:%s\n", Build.BRAND, // Build.DEVICE, // Build.BOARD, // Build.DISPLAY, Build.MODEL, // Build.PRODUCT, Build.VERSION.RELEASE);//w ww. j a v a 2 s . co m }
From source file:org.zywx.wbpalmstar.engine.EBrowserView.java
private void closeHardwareForSpecificString() { String[] strs = EUExUtil.getStringArray("platform_close_hardware"); if (strs != null) { for (int i = 0; i < strs.length; i++) { String str = strs[i].trim(); // ??Android? if (Build.MODEL.trim().equals(str) || Build.BRAND.trim().equals(str) || Build.MANUFACTURER.trim().equals(str)) { setLayerType(View.LAYER_TYPE_SOFTWARE, null); BDebug.i("setLayerType", "LAYER_TYPE_SOFTWARE"); break; }//from w ww. j av a2s. com } } }
From source file:net.frakbot.FWeather.util.FeedbackService.java
/** * Builds a feedback email body with some basic system info. * * @return Returns the generated system info. *//*from w w w .j a va2 s .co m*/ @SuppressWarnings("StringBufferReplaceableByString") private String generateFeedbackBody() { StringBuilder sb = new StringBuilder("\n\n" + "-----------\n" + "System info\n" + "-----------\n\n"); // HW information sb.append("Device model: ").append(Build.MODEL).append("\n"); sb.append("Manifacturer: ").append(Build.MANUFACTURER).append("\n"); sb.append("Brand: ").append(Build.BRAND).append("\n"); sb.append("CPU ABI: ").append(Build.CPU_ABI).append("\n"); sb.append("Product: ").append(Build.PRODUCT).append("\n").append("\n"); // SW information sb.append("Android version: ").append(Build.VERSION.CODENAME).append("\n"); sb.append("Release: ").append(Build.VERSION.RELEASE).append("\n"); sb.append("Incremental: ").append(Build.VERSION.INCREMENTAL).append("\n"); sb.append("Build: ").append(Build.FINGERPRINT).append("\n"); sb.append("Kernel: ").append(getKernelVersion()).append("\n"); // App info sb.append("App version: ").append(getAppVersionNumber(this)); return sb.toString(); }
From source file:com.github.javiersantos.piracychecker.LibraryUtils.java
/** * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions * and limitations under the License./* w ww . j a v a2s .c o m*/ * * Copyright (C) 2013, Vladislav Gingo Skoumal (http://www.skoumal.net) */ static boolean isInEmulator(boolean deepCheck) { int ratingCheckEmulator = 0; if (Build.PRODUCT.contains("sdk") || Build.PRODUCT.contains("Andy") || Build.PRODUCT.contains("ttVM_Hdragon") || Build.PRODUCT.contains("google_sdk") || Build.PRODUCT.contains("Droid4X") || Build.PRODUCT.contains("nox") || Build.PRODUCT.contains("sdk_x86") || Build.PRODUCT.contains("sdk_google") || Build.PRODUCT.contains("vbox86p")) { ratingCheckEmulator++; } if (Build.MANUFACTURER.equals("unknown") || Build.MANUFACTURER.equals("Genymotion") || Build.MANUFACTURER.contains("Andy") || Build.MANUFACTURER.contains("MIT") || Build.MANUFACTURER.contains("nox") || Build.MANUFACTURER.contains("TiantianVM")) { ratingCheckEmulator++; } if (Build.BRAND.equals("generic") || Build.BRAND.equals("generic_x86") || Build.BRAND.equals("TTVM") || Build.BRAND.contains("Andy")) { ratingCheckEmulator++; } if (Build.DEVICE.contains("generic") || Build.DEVICE.contains("generic_x86") || Build.DEVICE.contains("Andy") || Build.DEVICE.contains("ttVM_Hdragon") || Build.DEVICE.contains("Droid4X") || Build.DEVICE.contains("nox") || Build.DEVICE.contains("generic_x86_64") || Build.DEVICE.contains("vbox86p")) { ratingCheckEmulator++; } if (Build.MODEL.equals("sdk") || Build.MODEL.equals("google_sdk") || Build.MODEL.contains("Droid4X") || Build.MODEL.contains("TiantianVM") || Build.MODEL.contains("Andy") || Build.MODEL.equals("Android SDK built for x86_64") || Build.MODEL.equals("Android SDK built for x86")) { ratingCheckEmulator++; } if (Build.HARDWARE.equals("goldfish") || Build.HARDWARE.equals("vbox86") || Build.HARDWARE.contains("nox") || Build.HARDWARE.contains("ttVM_x86")) { ratingCheckEmulator++; } if (Build.FINGERPRINT.contains("generic") || Build.FINGERPRINT.contains("generic/sdk/generic") || Build.FINGERPRINT.contains("generic_x86/sdk_x86/generic_x86") || Build.FINGERPRINT.contains("Andy") || Build.FINGERPRINT.contains("ttVM_Hdragon") || Build.FINGERPRINT.contains("generic_x86_64") || Build.FINGERPRINT.contains("generic/google_sdk/generic") || Build.FINGERPRINT.contains("vbox86p") || Build.FINGERPRINT.contains("generic/vbox86p/vbox86p")) { ratingCheckEmulator++; } if (deepCheck) { try { String opengl = GLES20.glGetString(GLES20.GL_RENDERER); if (opengl != null) { if (opengl.contains("Bluestacks") || opengl.contains("Translator")) ratingCheckEmulator += 10; } } catch (Exception ignored) { } try { File sharedFolder = new File(Environment.getExternalStorageDirectory().toString() + File.separatorChar + "windows" + File.separatorChar + "BstSharedFolder"); if (sharedFolder.exists()) ratingCheckEmulator += 10; } catch (Exception ignored) { } } return ratingCheckEmulator > 3; }
From source file:com.architjn.materialicons.ui.fragments.HomeFragment.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == android.R.id.home) { drawer.openDrawer(Gravity.LEFT); }//from www. ja v a 2 s . c om if (id == R.id.action_sendemail) { StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + getResources().getString(R.string.email_id))); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); emailBuilder.append("\n \n \nOS Version: ").append(System.getProperty("os.version")).append("(") .append(Build.VERSION.INCREMENTAL).append(")"); emailBuilder.append("\nOS API Level: ").append(Build.VERSION.SDK_INT); emailBuilder.append("\nDevice: ").append(Build.DEVICE); emailBuilder.append("\nManufacturer: ").append(Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): ").append(Build.MODEL).append(" (").append(Build.PRODUCT) .append(")"); PackageInfo appInfo = null; try { appInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } assert appInfo != null; emailBuilder.append("\nApp Version Name: ").append(appInfo.versionName); emailBuilder.append("\nApp Version Code: ").append(appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title)))); return true; } else if (id == R.id.action_share) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = getResources().getString(R.string.share_one) + getResources().getString(R.string.developer_name) + getResources().getString(R.string.share_two) + MARKET_URL + getActivity().getPackageName(); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title)))); } else if (id == R.id.action_changelog) { showChangelog(); } return super.onOptionsItemSelected(item); }
From source file:com.linroid.pushapp.ui.bind.BindActivity.java
private Device queryAndBuildDeviceInfo() { DisplayMetrics metrics = getResources().getDisplayMetrics(); return Device.DeviceBuilder.aDevice().withModel(Build.MODEL).withSdkLevel(Build.VERSION.SDK_INT) .withOsName(Build.VERSION.RELEASE).withNetworkType(DeviceUtil.networkType(this)) .withCpuType(Build.CPU_ABI).withAlias(aliasET.getText().toString()).withDpi(metrics.densityDpi) .withHeight(AndroidUtil.getRealHeight(getWindowManager().getDefaultDisplay())) .withWidth(metrics.widthPixels).withMemorySize(AndroidUtil.totalMemorySize()).withToken(bindToken) .withUniqueId(DeviceUtil.id(this)).withInstallId(JPushInterface.getRegistrationID(this)).build(); }