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.speedtong.example.ui.chatting.ChattingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { LogUtil.d(TAG, "onCreate"); super.onCreate(savedInstanceState); brand = Build.MODEL + Build.BRAND; TelephonyManager tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE); uuid = tm.getDeviceId();// w w w .j a va 2s .co m messageDao = MessageDao.getInstance(this); toast = Toast.makeText(this, "", Toast.LENGTH_SHORT); sdpath = Environment.getExternalStorageDirectory().getAbsolutePath(); // ??? initView(); // ??? initActivityState(savedInstanceState); final ArrayList<ECMessage> list = IMessageSqlManager.queryIMessageList(mThread, 20, getMessageAdapterLastMessageTime() + ""); mListView.post(new Runnable() { @Override public void run() { mChattingAdapter.setData(list); if (mChattingAdapter.getCount() < 20) { //mPullDownView.setPullEnabled(false); //mPullDownView.setPullViewVisibed(false); } mListView.clearFocus(); mChattingAdapter.notifyDataSetChanged(); mListView.setSelection(mChattingAdapter.getCount()); } }); // ?IM?API mChatManager = SDKCoreHelper.getECChatManager(); HandlerThread thread = new HandlerThread("ChattingVoiceRecord", Process.THREAD_PRIORITY_BACKGROUND); thread.start(); // Get the HandlerThread's Looper and use it for our Handler mChattingLooper = thread.getLooper(); mVoiceHandler = new Handler(mChattingLooper); mVoiceHandler.post(new Runnable() { @Override public void run() { doEmojiPanel(); } }); }
From source file:com.savor.ads.core.Session.java
private Session(Context context) { mContext = context;/*w ww .j a v a2 s . c o m*/ mPreference = new SaveFileData(context, "savor"); osVersion = Build.VERSION.SDK_INT; buildVersion = Build.VERSION.RELEASE; model = Build.MODEL; brand = Build.BRAND; romVersion = Build.VERSION.INCREMENTAL; try { // AppUtils.clearExpiredFile(context, false); // AppUtils.clearExpiredCacheFile(context); readSettings(); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.gdg.frisbee.android.widget.FeedbackFragment.java
private void buildProperties() { addProperty(PROPERTY_MODEL, Build.MODEL); addProperty(PROPERTY_ANDROID_VERSION, VERSION.RELEASE); try {/*from www .j av a2s.c o m*/ WifiManager cm = (WifiManager) getActivity().getSystemService(Context.WIFI_SERVICE); WifiInfo e = cm.getConnectionInfo(); SupplicantState mobileDataEnabled = e.getSupplicantState(); addProperty(PROPERTY_WI_FI_ENABLED, mobileDataEnabled); } catch (Exception e) { Timber.d(e, "Wifi Manager problem."); } boolean mobileDataEnabled1 = false; ConnectivityManager cm1 = (ConnectivityManager) getActivity() .getSystemService(Context.CONNECTIVITY_SERVICE); try { Class e1 = Class.forName(cm1.getClass().getName()); Method resolution = e1.getDeclaredMethod("getMobileDataEnabled"); resolution.setAccessible(true); mobileDataEnabled1 = (Boolean) resolution.invoke(cm1); } catch (Exception e) { Timber.d(e, "Mobil data problem."); } addProperty(PROPERTY_MOBILE_DATA_ENABLED, mobileDataEnabled1); try { LocationManager e2 = (LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE); boolean resolution1 = e2.isProviderEnabled("gps"); addProperty(PROPERTY_GPS_ENABLED, resolution1); } catch (Exception e) { Timber.d(e, "GPS problem."); } try { DisplayMetrics e3 = new DisplayMetrics(); getActivity().getWindowManager().getDefaultDisplay().getMetrics(e3); String resolution2 = Integer.toString(e3.widthPixels) + "x" + Integer.toString(e3.heightPixels); addProperty(PROPERTY_SCREEN_RESOLUTION, resolution2); } catch (Exception e) { Timber.d(e, "Screen density problem."); } try { String e4 = getActivity().getClass().getSimpleName(); addProperty(PROPERTY_ACTIVITY, e4); } catch (Exception e) { Timber.d(e, "Activity name problem."); } PackageManager manager = getActivity().getPackageManager(); try { PackageInfo e = manager.getPackageInfo(getActivity().getPackageName(), 0); addProperty(PROPERTY_APP_VERSION_NAME, e.versionName); addProperty(PROPERTY_APP_VERSION_CODE, e.versionCode); } catch (PackageManager.NameNotFoundException var7) { Timber.d("Problem with PackageManager"); } }
From source file:com.netease.qa.emmagee.utils.CpuInfo.java
/** * reserve used ratio of process CPU and total CPU, meanwhile collect * network traffic.//w ww . jav a 2 s. co m * * @return network traffic ,used ratio of process CPU and total CPU in * certain interval */ public ArrayList<String> getCpuRatioInfo(String totalBatt, String currentBatt, String temperature, String voltage, String fps, boolean isRoot) { String heapData = ""; DecimalFormat fomart = new DecimalFormat(); fomart.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); fomart.setGroupingUsed(false); fomart.setMaximumFractionDigits(2); fomart.setMinimumFractionDigits(2); cpuUsedRatio.clear(); idleCpu.clear(); totalCpu.clear(); totalCpuRatio.clear(); readCpuStat(); try { String mDateTime2; Calendar cal = Calendar.getInstance(); if ((Build.MODEL.equals("sdk")) || (Build.MODEL.equals("google_sdk"))) { mDateTime2 = formatterFile.format(cal.getTime().getTime() + 8 * 60 * 60 * 1000); totalBatt = Constants.NA; currentBatt = Constants.NA; temperature = Constants.NA; voltage = Constants.NA; } else mDateTime2 = formatterFile.format(cal.getTime().getTime()); if (isInitialStatics) { preTraffic = trafficInfo.getTrafficInfo(); isInitialStatics = false; } else { lastestTraffic = trafficInfo.getTrafficInfo(); if (preTraffic == -1) traffic = -1; else { if (lastestTraffic > preTraffic) { traffic += (lastestTraffic - preTraffic + 1023) / 1024; } } preTraffic = lastestTraffic; Log.d(LOG_TAG, "lastestTraffic===" + lastestTraffic); Log.d(LOG_TAG, "preTraffic===" + preTraffic); StringBuffer totalCpuBuffer = new StringBuffer(); if (null != totalCpu2 && totalCpu2.size() > 0) { processCpuRatio = fomart.format(100 * ((double) (processCpu - processCpu2) / ((double) (totalCpu.get(0) - totalCpu2.get(0))))); for (int i = 0; i < (totalCpu.size() > totalCpu2.size() ? totalCpu2.size() : totalCpu.size()); i++) { String cpuRatio = "0.00"; if (totalCpu.get(i) - totalCpu2.get(i) > 0) { cpuRatio = fomart.format(100 * ((double) ((totalCpu.get(i) - idleCpu.get(i)) - (totalCpu2.get(i) - idleCpu2.get(i))) / (double) (totalCpu.get(i) - totalCpu2.get(i)))); } totalCpuRatio.add(cpuRatio); totalCpuBuffer.append(cpuRatio + Constants.COMMA); } } else { processCpuRatio = "0"; totalCpuRatio.add("0"); totalCpuBuffer.append("0,"); totalCpu2 = (ArrayList<Long>) totalCpu.clone(); processCpu2 = processCpu; idleCpu2 = (ArrayList<Long>) idleCpu.clone(); } // cpucsv for (int i = 0; i < getCpuNum() - totalCpuRatio.size() + 1; i++) { totalCpuBuffer.append("0.00,"); } long pidMemory = mi.getPidMemorySize(pid, context); String pMemory = fomart.format((double) pidMemory / 1024); long freeMemory = mi.getFreeMemorySize(context); String fMemory = fomart.format((double) freeMemory / 1024); String percent = context.getString(R.string.stat_error); if (totalMemorySize != 0) { percent = fomart.format(((double) pidMemory / (double) totalMemorySize) * 100); } if (isPositive(processCpuRatio) && isPositive(totalCpuRatio.get(0))) { String trafValue; // whether certain device supports traffic statics or not if (traffic == -1) { trafValue = Constants.NA; } else { trafValue = String.valueOf(traffic); } if (isRoot) { String[][] heapArray = MemoryInfo.getHeapSize(pid, context); heapData = heapArray[0][1] + "/" + heapArray[0][0] + Constants.COMMA + heapArray[1][1] + "/" + heapArray[1][0] + Constants.COMMA; } EmmageeService.bw.write(mDateTime2 + Constants.COMMA + ProcessInfo.getTopActivity(context) + Constants.COMMA + heapData + pMemory + Constants.COMMA + percent + Constants.COMMA + fMemory + Constants.COMMA + processCpuRatio + Constants.COMMA + totalCpuBuffer.toString() + trafValue + Constants.COMMA + totalBatt + Constants.COMMA + currentBatt + Constants.COMMA + temperature + Constants.COMMA + voltage + Constants.COMMA + fps + Constants.LINE_END); JSONObject jsonobj = new JSONObject(); JSONArray jsonarr = new JSONArray(); jsonarr.put(System.currentTimeMillis()); jsonarr.put(pMemory); jsonarr.put(percent); jsonarr.put(fMemory); jsonarr.put(processCpuRatio); jsonarr.put(totalCpuBuffer.toString().split(",")[0]); jsonarr.put(trafValue); jsonarr.put(totalBatt); jsonarr.put(currentBatt); jsonarr.put(temperature); jsonarr.put(voltage); jsonarr.put(fps); jsonobj.put("testSuitId", HttpUtils.testSuitId); jsonobj.put("data", jsonarr); HttpUtils.postAppPerfData(jsonobj.toString()); totalCpu2 = (ArrayList<Long>) totalCpu.clone(); processCpu2 = processCpu; idleCpu2 = (ArrayList<Long>) idleCpu.clone(); cpuUsedRatio.add(processCpuRatio); cpuUsedRatio.add(totalCpuRatio.get(0)); cpuUsedRatio.add(String.valueOf(traffic)); } } } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } return cpuUsedRatio; }
From source file:it.evilsocket.dsploit.core.System.java
public static void reloadNetworkMapping() { try {/*from w w w . ja v a 2 s . com*/ mNetwork = new Network(mContext); Target network = new Target(mNetwork), gateway = new Target(mNetwork.getGatewayAddress(), mNetwork.getGatewayHardware()), device = new Target(mNetwork.getLocalAddress(), mNetwork.getLocalHardware()); gateway.setAlias(mNetwork.getSSID()); device.setAlias(android.os.Build.MODEL); mTargets.clear(); mTargets.add(network); mTargets.add(gateway); mTargets.add(device); mInitialized = true; } catch (NoRouteToHostException nrthe) { // swallow bitch } catch (Exception e) { errorLogging(TAG, e); } }
From source file:com.iiordanov.bVNC.RemoteCanvas.java
/** * Constructor used by the inflation apparatus * /*from w ww . j a v a 2 s. c om*/ * @param context */ public RemoteCanvas(final Context context, AttributeSet attrs) { super(context, attrs); clipboard = (ClipboardManager) getContext().getSystemService(Context.CLIPBOARD_SERVICE); decoder = new Decoder(this); isRdp = getContext().getPackageName().contains("RDP"); isSpice = getContext().getPackageName().contains("SPICE"); final Display display = ((Activity) context).getWindow().getWindowManager().getDefaultDisplay(); displayWidth = display.getWidth(); displayHeight = display.getHeight(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); displayDensity = metrics.density; if (android.os.Build.MODEL.contains("BlackBerry") || android.os.Build.BRAND.contains("BlackBerry") || android.os.Build.MANUFACTURER.contains("BlackBerry")) { bb = true; } }
From source file:it.mb.whatshare.CallGooGlInbound.java
private static String getURL(String encodedId, String deviceAssignedID) { StringBuilder builder = new StringBuilder("http://"); Random generator = new Random(); int sum = 0;//w ww. j av a2 s.c o m for (int i = 0; i < 8; i++) { char rand = CHARACTERS[generator.nextInt(CHARACTERS.length)]; builder.append(rand); // no idea why they set lowercase for domain names... sum += CHAR_MAP.get(Character.toLowerCase(rand)); } builder.append("/"); builder.append(sum); builder.append("?model="); try { builder.append(URLEncoder .encode(String.format("%s %s", Utils.capitalize(Build.MANUFACTURER), Build.MODEL), "UTF-8") .replaceAll("\\+", "%20")); builder.append("&yourid="); builder.append(deviceAssignedID); builder.append("&id="); builder.append(encodedId); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } return builder.toString(); }
From source file:uk.ac.horizon.artcodes.camera.CameraView.java
private void openCamera(int cameraId) { Log.i("Scanner", "Device manufacturer: " + android.os.Build.MANUFACTURER + " model: " + android.os.Build.MODEL); camera = Camera.open(cameraId);//from w ww . j a v a 2s . co m Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(cameraId, cameraInfo); Camera.Parameters parameters = camera.getParameters(); List<String> focusModes = parameters.getSupportedFocusModes(); if (//!android.os.Build.MANUFACTURER.equalsIgnoreCase("SAMSUNG") && focusModes != null && !(this.experience != null && this.experience.getRequestedAutoFocusMode() != null && (this.experience.getRequestedAutoFocusMode().equals("tapToFocus") || this.experience.getRequestedAutoFocusMode().equals("blurScore")) && focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) && focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } else if (focusModes != null && focusModes.contains(Camera.Parameters.FOCUS_MODE_AUTO)) { // if FOCUS_MODE_CONTINUOUS_VIDEO is not supported flag that manual auto-focus is needed every few seconds Log.w("Scanner", "Camera requires manual focusing"); parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_AUTO); if (!(this.experience.getRequestedAutoFocusMode() != null && this.experience.getRequestedAutoFocusMode().equals("blurScore"))) { deviceNeedsTapToFocus = true; } } float ratioOfSurface = (float) surfaceHeight / surfaceWidth; if (ratioOfSurface < 1) { ratioOfSurface = 1 / ratioOfSurface; } Log.i("Scanner", "Surface size: " + surfaceWidth + "x" + surfaceHeight + " (Ratio: " + ratioOfSurface + ")"); Log.i("Scanner", "Format = " + parameters.getPictureFormat()); // Step 2: Find scanner preview that is best match for estimated surface ratio final List<Camera.Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes(); Camera.Size bestFitSoFar = null; float ratioDifferenceOfBestFitSoFar = 0; StringBuilder cameraPreviewSizeDebugMessage = new StringBuilder("Available camera preview sizes: "); for (Camera.Size supportedSize : supportedPreviewSizes) { float ratio = (float) supportedSize.width / supportedSize.height; float ratioDifference = Math.abs(ratio - ratioOfSurface); cameraPreviewSizeDebugMessage.append(supportedSize.width); cameraPreviewSizeDebugMessage.append('x'); cameraPreviewSizeDebugMessage.append(supportedSize.height); cameraPreviewSizeDebugMessage.append(" ("); cameraPreviewSizeDebugMessage.append(ratio); cameraPreviewSizeDebugMessage.append(") "); if (bestFitSoFar == null || ratioDifference < ratioDifferenceOfBestFitSoFar) { bestFitSoFar = supportedSize; ratioDifferenceOfBestFitSoFar = ratioDifference; } } Log.i("Scanner", cameraPreviewSizeDebugMessage.toString()); if (bestFitSoFar != null) { // Would only be null if there are no supportedPreviewSizes this.debug_resolution = "Selected Preview Size: " + bestFitSoFar.width + "x" + bestFitSoFar.height + " (" + ((float) bestFitSoFar.width / (float) bestFitSoFar.height) + ")"; Log.i("Scanner", this.debug_resolution); parameters.setPreviewSize(bestFitSoFar.width, bestFitSoFar.height); camera.setParameters(parameters); info = new CameraInfo(cameraInfo, parameters, getDeviceRotation()); camera.setDisplayOrientation(info.getRotation()); setDetector(detector, experience); try { camera.setPreviewDisplay(surface); } catch (IOException e) { Log.w("Scanner", e.getMessage(), e); } camera.startPreview(); } }
From source file:edu.rowan.app.fragments.FoodRatingFragment.java
private static void getUserID(final Activity reference) { JsonQueryManager jsonQuery = JsonQueryManager.getInstance(reference); Map<String, String> params = new HashMap<String, String>(); params.put("ostype", Build.MANUFACTURER + ", " + Build.MODEL + " version: " + Build.VERSION.SDK_INT); jsonQuery.requestJson(CREATE_USER_ADDR, params, new Callback() { @Override//from w w w .jav a 2 s. c o m public void receiveJson(JSONObject json, String origin) { try { if (origin == CREATE_USER_ADDR) { if (json != null) { SharedPreferences prefs = reference.getSharedPreferences(PREFS, 0); Editor edit = prefs.edit(); edit.putString(USER_ID, json.getString(USER_ID)); edit.commit(); Log.d("Homescreen", "received json: " + json.getString("userID")); } } } catch (JSONException e) { e.printStackTrace(); } } }); }
From source file:net.zionsoft.obadiah.BookSelectionActivity.java
private void showUpdateDialog() { if (TextUtils.isEmpty(mPreferences.getString(Constants.PREF_KEY_LAST_READ_TRANSLATION, null))) { // do nothing if there's no translation installed (most likely it's the 1st time use) return;//from w w w.jav a2 s . c o m } if (AppUpdateChecker.shouldUpdate(this)) { DialogHelper.showDialog(BookSelectionActivity.this, false, R.string.dialog_new_version_available_message, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { startActivity(new Intent(Intent.ACTION_VIEW).setData(Constants.GOOGLE_PLAY_URI)); Analytics.trackUIEvent("upgrade_app"); } catch (ActivityNotFoundException e) { Analytics.trackException("Failed to open market for updating: " + Build.MANUFACTURER + ", " + Build.MODEL); // falls back to open a link in browser startActivity(new Intent(Intent.ACTION_VIEW) .setData(Uri.parse("http://www.zionsoft.net/bible-reader/"))); } } }, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Analytics.trackUIEvent("ignore_upgrade_app"); } }); AppUpdateChecker.markAsUpdateAsked(this); } }