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:org.opendatakit.survey.android.activities.MediaCaptureVideoActivity.java
@Override protected void onResume() { super.onResume(); if (afterResult) { // this occurs if we re-orient the phone during the save-recording // action returnResult();/* ww w.j ava 2s. co m*/ } else if (!hasLaunched && !afterResult) { Intent i = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); // to make the name unique... File f = ODKFileUtils.getAsFile(appName, (uriFragmentToMedia == null ? uriFragmentNewFileBase : uriFragmentToMedia)); int idx = f.getName().lastIndexOf('.'); if (idx == -1) { i.putExtra(Video.Media.DISPLAY_NAME, f.getName()); } else { i.putExtra(Video.Media.DISPLAY_NAME, f.getName().substring(0, idx)); } // Need to have this ugly code to account for // a bug in the Nexus 7 on 4.3 not returning the mediaUri in the data // of the intent - using the MediaStore.EXTRA_OUTPUT to get the data // Have it saving to an intermediate location instead of final destination // to allow the current location to catch issues with the intermediate file WebLogger.getLogger(appName).i(t, "The build of this device is " + android.os.Build.MODEL); if (NEXUS7.equals(android.os.Build.MODEL) && Build.VERSION.SDK_INT == 18) { nexus7Uri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO); i.putExtra(MediaStore.EXTRA_OUTPUT, nexus7Uri); } try { hasLaunched = true; startActivityForResult(i, ACTION_CODE); } catch (ActivityNotFoundException e) { String err = getString(R.string.activity_not_found, MediaStore.ACTION_VIDEO_CAPTURE); WebLogger.getLogger(appName).e(t, err); Toast.makeText(this, err, Toast.LENGTH_SHORT).show(); setResult(Activity.RESULT_CANCELED); finish(); } } }
From source file:com.truman.showtime.showtime.ui.fragment.TheaterListFragment.java
public void refreshWithLocation(Location location) { try {//w w w. j a v a 2 s . c o m mLastLocation = location; mRefreshLayout.post(new Runnable() { @Override public void run() { mRefreshLayout.setRefreshing(true); } }); if (Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK")) { ShowtimeAPITask api = new ShowtimeAPITask(); api.execute("33.8358", "-118.3406", "0", "Torrance,CA"); } else if (location != null) { fetchTimesForDate("0"); } else { if (location != null) { fetchTimesForDate("0"); } else { mRefreshLayout.post(new Runnable() { @Override public void run() { mRefreshLayout.setRefreshing(false); } }); Toast.makeText(mApplicationContext, getString(R.string.location_services_disabled), Toast.LENGTH_LONG).show(); } } } catch (NullPointerException e) { } }
From source file:com.truman.showtime.showtime.ui.fragment.MovieListFragment.java
public void refreshWithLocation(Location location) { try {/* w w w. j a v a 2 s.c o m*/ mLastLocation = location; mRefreshLayout.post(new Runnable() { @Override public void run() { mRefreshLayout.setRefreshing(true); } }); if (mLastLocation != null) { fetchTimesForDate("0"); } else { if (Build.MODEL.contains("google_sdk") || Build.MODEL.contains("Emulator") || Build.MODEL.contains("Android SDK")) { ShowtimeApiManager api = new ShowtimeApiManager(); api.execute("33.8358", "-118.3406", "0", "Torrance,CA"); } else if (mLastLocation != null) { fetchTimesForDate("0"); } else { mRefreshLayout.post(new Runnable() { @Override public void run() { mRefreshLayout.setRefreshing(false); } }); Toast.makeText(mApplicationContext, getString(R.string.location_services_disabled), Toast.LENGTH_LONG).show(); } } } catch (NullPointerException e) { } }
From source file:com.ada.utils.Log.java
public static void remote(final String msg) { if (mRemoteUrl == null) { return;//from w w w. j a va 2 s .co m } new Thread(new Runnable() { @Override public void run() { try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(mRemoteUrl); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("package_name", mPackageName)); params.add(new BasicNameValuePair("package_version", mPackageVersion)); params.add(new BasicNameValuePair("phone_model", Build.MODEL)); params.add(new BasicNameValuePair("sdk_version", Build.VERSION.RELEASE)); params.add(new BasicNameValuePair("message", msg)); httpPost.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); httpClient.execute(httpPost); } catch (Exception e) { } } }).start(); }
From source file:com.bosco.noticeboard.RegistrationIntentService.java
/** * Persist registration to third-party servers. * * Modify this method to associate the user's GCM registration token with any server-side account * maintained by your application./* ww w.j av a 2 s. c o m*/ * * @param token The new token. */ private String sendRegistrationToServer(String token) { //TODO Sync channels from server to mobile after reinstalling app // get device IMEI number TelephonyManager mngr = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); String IMEI = "UNKNOWN"; String deviceInfo = "UNKNOWN"; try { IMEI = mngr.getDeviceId(); JSONObject jsonObject = new JSONObject(); jsonObject.put("SDK", Build.VERSION.SDK_INT); jsonObject.put("RELEASE", Build.VERSION.RELEASE); jsonObject.put("MODEL", android.os.Build.MODEL); jsonObject.put("BRAND", Build.BRAND); jsonObject.put("MANUFACTURER", Build.MANUFACTURER); Log.d(TAG, "DEVICE : " + jsonObject.toString()); deviceInfo = jsonObject.toString(); } catch (Exception e) { Log.d(TAG, "Unable to device info"); } String url = NoticeBoardPreferences.URL_REGISTER_TOKEN; Map<String, String> payload = new HashMap<String, String>(); payload.put(NoticeBoardPreferences.KEY_TOKEN, token); payload.put(NoticeBoardPreferences.KEY_IMEI, IMEI); payload.put(NoticeBoardPreferences.KEY_DEVICE, deviceInfo); NetworkHandler nh = new NetworkHandler(payload, url); return nh.callServer(); }
From source file:com.appbackr.android.tracker.Tracker.java
/** * Generates a unique ID for the device. * //from w ww .j a v a2 s . c om * 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:net.olejon.mdapp.MyTools.java
public String getDevice() { String device = ""; try {/* w ww . j a va 2s. c o m*/ device = (Build.MANUFACTURER == null || Build.MODEL == null || Build.VERSION.SDK_INT < 1) ? "" : URLEncoder.encode(Build.MANUFACTURER + " " + Build.MODEL + " " + Build.VERSION.SDK_INT, "utf-8"); } catch (Exception e) { Log.e("MyTools", Log.getStackTraceString(e)); } return device; }
From source file:com.gigigo.vuforia.core.sdkimagerecognition.cloudrecognition.CloudRecognition.java
public void on_Create() { try {//from ww w . j a va2s. c o m if (this.mLicenseKey == "" || this.mAccessKey == "" || this.mSecretKey == "") { Log.e(this.mActivity.getResources().getString(R.string.orchextra_auth_error_tag), this.mActivity.getResources().getString(R.string.orchextra_auth_error_text)); this.mActivity.finish(); } else { vuforiaAppSession = new VuforiaSession(this, this.mLicenseKey); startLoadingAnimation(); vuforiaAppSession.initAR(this.mActivity, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // Creates the GestureDetector listener for processing double tap mGestureDetector = new GestureDetector(this.mActivity, new GestureListener()); mIsDroidDevice = android.os.Build.MODEL.toLowerCase().startsWith("droid"); } } catch (Throwable tr) { GGGLogImpl.log(tr.getMessage(), LogLevel.ERROR); } }
From source file:syncthing.android.service.SyncthingUtils.java
public static String generateName(boolean dashed) { String name = Build.MODEL.replaceAll("[^a-zA-Z0-9 ]", ""); if (name.startsWith("Android SDK built for")) name = "Nexus One"; String split[] = name.split(" "); name = split[0];// w w w . j ava2s. c o m for (int i = 1; i < split.length; i++) { if (name.length() + split[i].length() > 20) break; name += (dashed ? "-" : " ") + split[i]; } return name; }
From source file:de.androvdr.activities.AndroVDR.java
public void initWorkspaceView(Bundle savedInstanceState) { if (!Preferences.alternateLayout) setTheme(R.style.Theme_Original); logger.debug("Model: {}", Build.MODEL); logger.debug("SDK Version: {}", Build.VERSION.SDK_INT); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); logger.debug("Width: {}", metrics.widthPixels); logger.debug("Height: {}", metrics.heightPixels); logger.debug("Density: {}", metrics.densityDpi); Configuration conf = getResources().getConfiguration(); boolean screenSmall = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_SMALL) == Configuration.SCREENLAYOUT_SIZE_SMALL); boolean screenNormal = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_NORMAL) == Configuration.SCREENLAYOUT_SIZE_NORMAL); boolean screenLong = ((conf.screenLayout & Configuration.SCREENLAYOUT_LONG_YES) == Configuration.SCREENLAYOUT_LONG_YES); boolean screenLarge = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_LARGE) == Configuration.SCREENLAYOUT_SIZE_LARGE); boolean screenXLarge = ((conf.screenLayout & Configuration.SCREENLAYOUT_SIZE_XLARGE) == Configuration.SCREENLAYOUT_SIZE_XLARGE); logger.debug("Screen Small: {}", screenSmall); logger.debug("Screen Normal: {}", screenNormal); logger.debug("Screen Long: {}", screenLong); logger.debug("Screen Large: {}", screenLarge); logger.debug("Screen XLarge: {}", screenXLarge); if (screenSmall) Preferences.screenSize = Preferences.SCREENSIZE_SMALL; if (screenNormal) Preferences.screenSize = Preferences.SCREENSIZE_NORMAL; if (screenLong) Preferences.screenSize = Preferences.SCREENSIZE_LONG; if (screenLarge) Preferences.screenSize = Preferences.SCREENSIZE_LARGE; if (screenXLarge) Preferences.screenSize = Preferences.SCREENSIZE_XLARGE; logger.trace("Screen size: {}", Preferences.screenSize); // --- init default text size for buttons --- TextResizeButton.resetDefaultTextSize(); TextResizeButton rb = (TextResizeButton) LayoutInflater.from(this).inflate(R.layout.reference_button, null); if ((Preferences.screenSize >= Preferences.SCREENSIZE_LARGE) && (metrics.widthPixels > metrics.heightPixels)) rb.setTextSizeAsDefault(metrics.widthPixels / 2 / 5, 100); else//from w w w .j ava 2s .com rb.setTextSizeAsDefault(Math.min(metrics.widthPixels, metrics.heightPixels) / 4, 100); logger.debug("Default TextSize (px): {}", rb.getTextSize()); // --- landscape mode only on large displays --- if (Preferences.screenSize < Preferences.SCREENSIZE_LARGE) { logger.trace("setting SCREEN_ORIENTATION_PORTRAIT"); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } setContentView(R.layout.remote_pager); mPagerAdapter = new PagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mPagerAdapter); LinePageIndicator indicator = (LinePageIndicator) findViewById(R.id.titles); if (mPagerAdapter.getCount() > 1) { SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); int last = sp.getInt("remote_last_page", 0); if (last < mPagerAdapter.getCount()) indicator.setViewPager(mPager, last); else indicator.setViewPager(mPager); } else { indicator.setVisibility(View.GONE); } // --- show current channel in status bar --- if (Preferences.screenSize < Preferences.SCREENSIZE_XLARGE) mDevices.addOnSensorChangeListener("VDR.channel", 1, new OnSensorChangeListener() { @Override public void onChange(String result) { logger.trace("Channel: {}", result); Message msg = Message.obtain(mSensorHandler, SENSOR_CHANNEL); Bundle bundle = new Bundle(); bundle.putString(MSG_RESULT, result); msg.setData(bundle); msg.sendToTarget(); } }); mDevices.startSensorUpdater(0); }