List of usage examples for android.os Build TYPE
String TYPE
To view the source code for android.os Build TYPE.
Click Source Link
From source file:com.apptentive.android.sdk.storage.DeviceManager.java
private static Device generateNewDevice(Context context) { Device device = new Device(); // First, get all the information we can load from static resources. device.setOsName("Android"); device.setOsVersion(Build.VERSION.RELEASE); device.setOsBuild(Build.VERSION.INCREMENTAL); device.setOsApiLevel(String.valueOf(Build.VERSION.SDK_INT)); device.setManufacturer(Build.MANUFACTURER); device.setModel(Build.MODEL);// w w w . j a v a2s .c o m device.setBoard(Build.BOARD); device.setProduct(Build.PRODUCT); device.setBrand(Build.BRAND); device.setCpu(Build.CPU_ABI); device.setDevice(Build.DEVICE); device.setUuid(GlobalInfo.androidId); device.setBuildType(Build.TYPE); device.setBuildId(Build.ID); // Second, set the stuff that requires querying system services. TelephonyManager tm = ((TelephonyManager) (context.getSystemService(Context.TELEPHONY_SERVICE))); device.setCarrier(tm.getSimOperatorName()); device.setCurrentCarrier(tm.getNetworkOperatorName()); device.setNetworkType(Constants.networkTypeAsString(tm.getNetworkType())); // Finally, use reflection to try loading from APIs that are not available on all Android versions. device.setBootloaderVersion(Reflection.getBootloaderVersion()); device.setRadioVersion(Reflection.getRadioVersion()); device.setLocaleCountryCode(Locale.getDefault().getCountry()); device.setLocaleLanguageCode(Locale.getDefault().getLanguage()); device.setLocaleRaw(Locale.getDefault().toString()); device.setUtcOffset(String.valueOf((TimeZone.getDefault().getRawOffset() / 1000))); return device; }
From source file:name.setup.dance.DanceStepApp.java
/** Called when the activity is first created. */ @Override// w w w. j av a 2s . c om public void onCreate(Bundle savedInstanceState) { Log.i(TAG, "[ACTIVITY] onCreate"); super.onCreate(savedInstanceState); //mStepValue = 0; mPaceValue = 0; setContentView(R.layout.main); mUtils = Utils.getInstance(); String m_szDevIDShort = "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 mUtils.DeviceName = m_szDevIDShort; Log.v(TAG, "ID: " + m_szDevIDShort); Log.v(TAG, "UTILS: " + mUtils.DeviceName); // user name mTextField = (EditText) findViewById(R.id.name_area); mTextField.setCursorVisible(false); if (!(mUtils.UserName == "My Name")) { mTextField.setText(mUtils.UserName); } mTextField.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); // only will trigger it if no physical keyboard is open mgr.showSoftInput(mTextField, InputMethodManager.SHOW_IMPLICIT); mTextField.requestFocus(); mTextField.setCursorVisible(true); mOkayButton.setVisibility(View.VISIBLE); } }); // init okay Button mOkayButton = (Button) findViewById(R.id.okay_button); mOkayButton.setVisibility(View.INVISIBLE); mOkayButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(getWindow().getCurrentFocus().getWindowToken(), 0); mTextField.setCursorVisible(false); mTextField.clearFocus(); mUtils.UserName = mTextField.getText().toString(); // post name via HHTP new Thread(new Runnable() { public void run() { if (mIsMetric) { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue); } else { postHTTP(mUtils.DeviceName, mUtils.UserName, mStepValue, mDistanceValue * 1.609344f); } } }).start(); mOkayButton.setVisibility(View.INVISIBLE); // Post TOAST MESSAGE Toast.makeText(getApplicationContext(), getText(R.string.name_saved), Toast.LENGTH_SHORT).show(); } }); // init Score Button mScoreButton = (Button) findViewById(R.id.scoreButton); mScoreButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click String url = "http://www.setup.nl/tools/dancestep_app/index.php?id=" + mUtils.DeviceName + "&time=" + System.currentTimeMillis(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); startActivity(i); } }); }
From source file:com.google.android.gms.common.C0270e.java
public static boolean m3383a() { return f2126a ? f2127b : "user".equals(Build.TYPE); }
From source file:io.kristal.appinfos.AppInfosPlugin.java
private synchronized static String getUniqueId(Context context) { String uniqueID = null;/* www .j ava2 s. c o m*/ SharedPreferences sharedPrefs = context.getSharedPreferences(PREF_UNIQUE_ID, Context.MODE_PRIVATE); uniqueID = sharedPrefs.getString(PREF_UNIQUE_ID, null); if (uniqueID == null) { uniqueID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID); if (uniqueID == null || uniqueID.length() == 0 || "9774d56d682e549c".equals(uniqueID)) { // old version of reto meier //uniqueID = UUID.randomUUID().toString(); uniqueID = "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 } SharedPreferences.Editor editor = sharedPrefs.edit(); editor.putString(PREF_UNIQUE_ID, uniqueID); editor.commit(); } return uniqueID; }
From source file:de.akquinet.android.androlog.reporter.Report.java
/** * Adds the device data to the report./*w w w .j a va 2 s .c o m*/ * @param context * @throws JSONException if the device data cannot be added */ private void buildDeviceData(Context context) throws JSONException { device = new JSONObject(); device.put("device", Build.DEVICE); device.put("brand", Build.BRAND); Object windowService = context.getSystemService(Context.WINDOW_SERVICE); if (windowService instanceof WindowManager) { Display display = ((WindowManager) windowService).getDefaultDisplay(); device.put("resolution", display.getWidth() + "x" + display.getHeight()); device.put("orientation", display.getOrientation()); } device.put("display", Build.DISPLAY); device.put("manufacturer", Build.MANUFACTURER); device.put("model", Build.MODEL); device.put("product", Build.PRODUCT); device.put("build.type", Build.TYPE); device.put("android.version", Build.VERSION.SDK_INT); }
From source file:de.schildbach.wallet.util.CrashReporter.java
public static void appendDeviceInfo(final Appendable report, final Context context) throws IOException { final Resources res = context.getResources(); final android.content.res.Configuration config = res.getConfiguration(); final ActivityManager activityManager = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); final DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context .getSystemService(Context.DEVICE_POLICY_SERVICE); report.append("Device Model: " + Build.MODEL + "\n"); report.append("Android Version: " + Build.VERSION.RELEASE + "\n"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) report.append("Android security patch level: ").append(Build.VERSION.SECURITY_PATCH).append("\n"); report.append("ABIs: ").append(Joiner.on(", ").skipNulls().join(Strings.emptyToNull(Build.CPU_ABI), Strings.emptyToNull(Build.CPU_ABI2))).append("\n"); report.append("Board: " + Build.BOARD + "\n"); report.append("Brand: " + Build.BRAND + "\n"); report.append("Device: " + Build.DEVICE + "\n"); report.append("Display: " + Build.DISPLAY + "\n"); report.append("Finger Print: " + Build.FINGERPRINT + "\n"); report.append("Host: " + Build.HOST + "\n"); report.append("ID: " + Build.ID + "\n"); report.append("Product: " + Build.PRODUCT + "\n"); report.append("Tags: " + Build.TAGS + "\n"); report.append("Time: " + Build.TIME + "\n"); report.append("Type: " + Build.TYPE + "\n"); report.append("User: " + Build.USER + "\n"); report.append("Configuration: " + config + "\n"); report.append("Screen Layout: size " + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_SIZE_MASK) + " long " + (config.screenLayout & android.content.res.Configuration.SCREENLAYOUT_LONG_MASK) + "\n"); report.append("Display Metrics: " + res.getDisplayMetrics() + "\n"); report.append("Memory Class: " + activityManager.getMemoryClass() + "/" + activityManager.getLargeMemoryClass() + (ActivityManagerCompat.isLowRamDevice(activityManager) ? " (low RAM device)" : "") + "\n"); report.append("Storage Encryption Status: " + devicePolicyManager.getStorageEncryptionStatus() + "\n"); report.append("Bluetooth MAC: " + bluetoothMac() + "\n"); report.append("Runtime: ").append(System.getProperty("java.vm.name")).append(" ") .append(System.getProperty("java.vm.version")).append("\n"); }
From source file:com.example.feedback.ActivityMain.java
/** * Get device information and save to application cache to send as attachment in feedback email. *///from w w w. ja v a 2 s . c o m public void getDeviceInfo() { try { dateTime = new Date(); timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS", Locale.US); packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); appName = getApplicationContext().getString(packageInfo.applicationInfo.labelRes); appVersion = packageInfo.versionName; appCode = Integer.toString(packageInfo.versionCode); // Get application information. stringInfo = "date/time: " + timeFormat.format(dateTime) + "\n\n"; stringInfo += "packageName: " + packageInfo.packageName + "\n"; stringInfo += "packageCode: " + appCode + "\n"; stringInfo += "packageVersion: " + appVersion + "\n"; // Get network information. telephonyManager = ((TelephonyManager) getApplicationContext() .getSystemService(Context.TELEPHONY_SERVICE)); if (!telephonyManager.getNetworkOperatorName().equals("")) { stringInfo += "operatorNetName: " + telephonyManager.getNetworkOperatorName() + "\n"; } else if (!telephonyManager.getSimOperatorName().equals("")) { stringInfo += "operatorSimName: " + telephonyManager.getSimOperatorName() + "\n"; } // Get device information. stringInfo += "Build.MODEL: " + Build.MODEL + "\n"; stringInfo += "Build.BRAND: " + Build.BRAND + "\n"; stringInfo += "Build.DEVICE: " + Build.DEVICE + "\n"; stringInfo += "Build.PRODUCT: " + Build.PRODUCT + "\n"; stringInfo += "Build.ID: " + Build.ID + "\n"; stringInfo += "Build.TYPE: " + Build.TYPE + "\n"; stringInfo += "Build.VERSION.SDK_INT: " + Build.VERSION.SDK_INT + "\n"; stringInfo += "Build.VERSION.RELEASE: " + Build.VERSION.RELEASE + "\n"; stringInfo += "Build.VERSION.INCREMENTAL: " + Build.VERSION.INCREMENTAL + "\n"; stringInfo += "Build.VERSION.CODENAME: " + Build.VERSION.CODENAME + "\n"; stringInfo += "Build.BOARD: " + Build.BOARD + "\n\n"; // Get other application information. activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE); runningProcesses = activityManager.getRunningAppProcesses(); runningApplications = ""; for (ActivityManager.RunningAppProcessInfo runningProcess : runningProcesses) { runningApplications += "\n " + runningProcess.processName; } stringInfo += "Applications running:" + runningApplications; // Save information to cached file. fileOutput = new FileOutputStream(getCacheDir().getAbsolutePath() + "/deviceInfo.log"); fileOutput.write(stringInfo.getBytes()); fileOutput.close(); } catch (Exception e) { } }
From source file:org.cook_e.cook_e.BugReportActivity.java
/** * Gathers information about the device running the application and returns it as a JSONObject * @return information about the system/*from w w w .jav a2s . co m*/ */ private JSONObject getSystemInformation() { final JSONObject json = new JSONObject(); try { final JSONObject build = new JSONObject(); build.put("version_name", BuildConfig.VERSION_NAME); build.put("version_code", BuildConfig.VERSION_CODE); build.put("build_type", BuildConfig.BUILD_TYPE); build.put("debug", BuildConfig.DEBUG); json.put("build", build); final JSONObject device = new JSONObject(); device.put("board", Build.BOARD); device.put("bootloader", Build.BOOTLOADER); device.put("brand", Build.BRAND); device.put("device", Build.DEVICE); device.put("display", Build.DISPLAY); device.put("fingerprint", Build.FINGERPRINT); device.put("hardware", Build.HARDWARE); device.put("host", Build.HOST); device.put("id", Build.ID); device.put("manufacturer", Build.MANUFACTURER); device.put("model", Build.MODEL); device.put("product", Build.PRODUCT); device.put("radio", Build.getRadioVersion()); device.put("serial", Build.SERIAL); device.put("tags", Build.TAGS); device.put("time", Build.TIME); device.put("type", Build.TYPE); device.put("user", Build.USER); json.put("device", device); } catch (JSONException e) { // Ignore } return json; }
From source file:com.appbackr.android.tracker.Tracker.java
/** * Generates a unique ID for the device. * /*w ww . j a v a 2 s .c o m*/ * This function obtain the Unique ID from the phone. The Unique ID consist of * Build.BOARD + Build.BRAND + Build.CPU_ABI * + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST * + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT * + Build.TAGS + Build.TYPE + Build.USER; * + IMEI (GSM) or MEID/ESN (CDMA) * + Android-assigned id * * The Android ID may be changed everytime the user perform Factory Reset * I heard that IMEI values might not be unique because phone factory * might reuse IMEI values to cut cost. * * While the ID might be different from the same device, but resetting of the * Android phone should not occur that often. The values should be close * enough. * * @param c android application contact * @return unique ID as md5 hash generated of available parameters from device and cell phone service provider */ private static String getUDID(Context c) { // Get some of the hardware information String buildParams = Build.BOARD + Build.BRAND + Build.CPU_ABI + Build.DEVICE + Build.DISPLAY + Build.FINGERPRINT + Build.HOST + Build.ID + Build.MANUFACTURER + Build.MODEL + Build.PRODUCT + Build.TAGS + Build.TYPE + Build.USER; // Requires READ_PHONE_STATE TelephonyManager tm = (TelephonyManager) c.getSystemService(Context.TELEPHONY_SERVICE); // gets the imei (GSM) or MEID/ESN (CDMA) String imei = tm.getDeviceId(); // gets the android-assigned id String androidId = Secure.getString(c.getContentResolver(), Secure.ANDROID_ID); // concatenate the string String fullHash = buildParams.toString() + imei + androidId; return md5(fullHash); }
From source file:com.android.tv.settings.about.AboutFragment.java
@Override public void onResume() { super.onResume(); final boolean developerEnabled = Settings.Global.getInt(getActivity().getContentResolver(), Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, android.os.Build.TYPE.equals("eng") ? 1 : 0) == 1; mDevHitCountdown = developerEnabled ? -1 : TAPS_TO_BE_A_DEVELOPER; mDevHitToast = null;//from www .ja v a 2 s. c o m }