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.onesignal.OneSignal.java
private static void registerUser() { Log(LOG_LEVEL.DEBUG,/*from w w w . j a v a 2 s.co m*/ "registerUser: registerForPushFired:" + registerForPushFired + ", locationFired: " + locationFired); if (!registerForPushFired || !locationFired) return; if (ranSessionInitThread) { updateRegistrationId(); return; } ranSessionInitThread = true; new Thread(new Runnable() { public void run() { OneSignalStateSynchronizer.UserState userState = OneSignalStateSynchronizer.getNewUserState(); String packageName = appContext.getPackageName(); PackageManager packageManager = appContext.getPackageManager(); userState.set("app_id", appId); userState.set("identifier", lastRegistrationId); String adId = mainAdIdProvider.getIdentifier(appContext); // "... must use the advertising ID (when available on a device) in lieu of any other device identifiers ..." // https://play.google.com/about/developer-content-policy.html if (adId == null) adId = new AdvertisingIdProviderFallback().getIdentifier(appContext); userState.set("ad_id", adId); userState.set("device_os", Build.VERSION.RELEASE); userState.set("timezone", getTimeZoneOffset()); userState.set("language", Locale.getDefault().getLanguage()); userState.set("sdk", VERSION); userState.set("sdk_type", sdkType); userState.set("android_package", packageName); userState.set("device_model", Build.MODEL); userState.set("device_type", deviceType); userState.setState("subscribableStatus", subscribableStatus); try { userState.set("game_version", packageManager.getPackageInfo(packageName, 0).versionCode); } catch (PackageManager.NameNotFoundException e) { } List<PackageInfo> packList = packageManager.getInstalledPackages(0); int count = -1; for (int i = 0; i < packList.size(); i++) count += ((packList.get(i).applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) ? 1 : 0; userState.set("pkgc", count); userState.set("net_type", osUtils.getNetType()); userState.set("carrier", osUtils.getCarrierName()); userState.set("rooted", RootToolsInternalMethods.isRooted()); userState.set("lat", lastLocLat); userState.set("long", lastLocLong); userState.set("loc_acc", lastLocAcc); userState.set("loc_type", lastLocType); OneSignalStateSynchronizer.postSession(userState); } }).start(); }
From source file:edu.pdx.cecs.orcycle.MyApplication.java
private void loadDeviceInfo() { // Determine application information versionName = ""; versionCode = 0;/*w ww .j av a 2 s . co m*/ try { Context context = this.getBaseContext(); PackageInfo pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); versionName = pInfo.versionName; versionCode = pInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } appVersion = versionName + " (" + versionCode + ") on Android " + Build.VERSION.RELEASE; // Determine model information String manufacturer = Build.MANUFACTURER; String model = Build.MODEL; if (model.startsWith(manufacturer)) { deviceModel = capitalize(model); } else { deviceModel = capitalize(manufacturer) + " " + model; } }
From source file:com.pimp.companionforband.activities.main.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); sContext = getApplicationContext();/*from w ww .java2 s. c o m*/ sActivity = this; sharedPreferences = getApplicationContext().getSharedPreferences("MyPrefs", 0); editor = sharedPreferences.edit(); bandSensorData = new BandSensorData(); mDestinationUri = Uri.fromFile(new File(getCacheDir(), SAMPLE_CROPPED_IMAGE_NAME)); SectionsPagerAdapter mSectionsPagerAdapter; ViewPager mViewPager; if (!checkCameraPermission(true)) requestCameraPermission(true); if (!checkCameraPermission(false)) requestCameraPermission(false); FiveStarsDialog fiveStarsDialog = new FiveStarsDialog(this, "pimplay69@gmail.com"); fiveStarsDialog.setTitle(getString(R.string.rate_dialog_title)) .setRateText(getString(R.string.rate_dialog_text)).setForceMode(false).setUpperBound(4) .setNegativeReviewListener(this).showAfter(5); AnalyticsApplication application = (AnalyticsApplication) getApplication(); mTracker = application.getDefaultTracker(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); mViewPager = (ViewPager) findViewById(R.id.container); mViewPager.setAdapter(mSectionsPagerAdapter); mViewPager.setOffscreenPageLimit(2); mViewPager.setPageTransformer(true, new ZoomOutPageTransformer()); mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { } @Override public void onPageSelected(int position) { String name; switch (position) { case 0: name = "THEME"; break; case 1: name = "SENSORS"; break; case 2: name = "EXTRAS"; break; default: name = "CfB"; } mTracker.setScreenName("Image~" + name); mTracker.send(new HitBuilders.ScreenViewBuilder().build()); logSwitch = (Switch) findViewById(R.id.log_switch); backgroundLogSwitch = (Switch) findViewById(R.id.backlog_switch); logStatus = (TextView) findViewById(R.id.logStatus); backgroundLogStatus = (TextView) findViewById(R.id.backlogStatus); } @Override public void onPageScrollStateChanged(int state) { } }); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(mViewPager); Drawable headerBackground = null; String encoded = sharedPreferences.getString("me_tile_image", "null"); if (!encoded.equals("null")) { byte[] imageAsBytes = Base64.decode(encoded.getBytes(), Base64.DEFAULT); headerBackground = new BitmapDrawable( BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length)); } AccountHeader accountHeader = new AccountHeaderBuilder().withActivity(this).withCompactStyle(true) .withHeaderBackground((headerBackground == null) ? getResources().getDrawable(R.drawable.pipboy) : headerBackground) .addProfiles(new ProfileDrawerItem() .withName(sharedPreferences.getString("device_name", "Companion For Band")) .withEmail(sharedPreferences.getString("device_mac", "pimplay69@gmail.com")) .withIcon(getResources().getDrawable(R.drawable.band))) .build(); result = new DrawerBuilder().withActivity(this).withToolbar(toolbar).withActionBarDrawerToggleAnimated(true) .withAccountHeader(accountHeader) .addDrawerItems( new PrimaryDrawerItem().withName(getString(R.string.drawer_cloud)) .withIcon(GoogleMaterial.Icon.gmd_cloud).withIdentifier(1), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.rate)) .withIcon(GoogleMaterial.Icon.gmd_rate_review).withIdentifier(2), new PrimaryDrawerItem().withName(getString(R.string.feedback)) .withIcon(GoogleMaterial.Icon.gmd_feedback).withIdentifier(3), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.share)) .withIcon(GoogleMaterial.Icon.gmd_share).withIdentifier(4), new PrimaryDrawerItem().withName(getString(R.string.other)) .withIcon(GoogleMaterial.Icon.gmd_apps).withIdentifier(5), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.report)) .withIcon(GoogleMaterial.Icon.gmd_bug_report).withIdentifier(6), new PrimaryDrawerItem().withName(getString(R.string.translate)) .withIcon(GoogleMaterial.Icon.gmd_translate).withIdentifier(9), new DividerDrawerItem(), new PrimaryDrawerItem().withName(getString(R.string.support)) .withIcon(GoogleMaterial.Icon.gmd_attach_money).withIdentifier(7), new PrimaryDrawerItem().withName(getString(R.string.aboutLib)) .withIcon(GoogleMaterial.Icon.gmd_info).withIdentifier(8)) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { boolean flag; if (drawerItem != null) { flag = true; switch ((int) drawerItem.getIdentifier()) { case 1: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Cloud").build()); if (!sharedPreferences.getString("access_token", "hi").equals("hi")) startActivity(new Intent(getApplicationContext(), CloudActivity.class)); else startActivity(new Intent(getApplicationContext(), WebviewActivity.class)); break; case 2: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Rate and Review").build()); String MARKET_URL = "https://play.google.com/store/apps/details?id="; String PlayStoreListing = getPackageName(); Intent rate = new Intent(Intent.ACTION_VIEW, Uri.parse(MARKET_URL + PlayStoreListing)); startActivity(rate); break; case 3: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Feedback").build()); final StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:pimplay69@gmail.com")); intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.app_name)); 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 = getPackageManager().getPackageInfo(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, "Send via")); break; case 4: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Share").build()); Intent i = new AppInviteInvitation.IntentBuilder( getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message)) .setCallToActionText(getString(R.string.invitation_cta)).build(); startActivityForResult(i, REQUEST_INVITE); break; case 5: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Other Apps").build()); String PlayStoreDevAccount = "https://play.google.com/store/apps/developer?id=P.I.M.P."; Intent devPlay = new Intent(Intent.ACTION_VIEW, Uri.parse(PlayStoreDevAccount)); startActivity(devPlay); break; case 6: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Report Bugs").build()); startActivity(new Intent(MainActivity.this, GittyActivity.class)); break; case 7: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Donate").build()); String base64EncodedPublicKey = getString(R.string.base64); mHelper = new IabHelper(getApplicationContext(), base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Toast.makeText(MainActivity.this, "Problem setting up In-app Billing: " + result, Toast.LENGTH_LONG).show(); } } }); final Dialog dialog = new Dialog(MainActivity.this); dialog.setContentView(R.layout.dialog_donate); dialog.setTitle("Donate"); String[] title = { "Coke", "Coffee", "Burger", "Pizza", "Meal" }; String[] price = { "Rs. 10.00", "Rs. 50.00", "Rs. 100.00", "Rs. 500.00", "Rs. 1,000.00" }; ListView listView = (ListView) dialog.findViewById(R.id.list); listView.setAdapter(new DonateListAdapter(MainActivity.this, title, price)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: mHelper.launchPurchaseFlow(MainActivity.this, SKU_COKE, 1, mPurchaseFinishedListener, "payload"); break; case 1: mHelper.launchPurchaseFlow(MainActivity.this, SKU_COFFEE, 1, mPurchaseFinishedListener, "payload"); break; case 2: mHelper.launchPurchaseFlow(MainActivity.this, SKU_BURGER, 1, mPurchaseFinishedListener, "payload"); break; case 3: mHelper.launchPurchaseFlow(MainActivity.this, SKU_PIZZA, 1, mPurchaseFinishedListener, "payload"); break; case 4: mHelper.launchPurchaseFlow(MainActivity.this, SKU_MEAL, 1, mPurchaseFinishedListener, "payload"); break; } } }); dialog.show(); break; case 8: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("About").build()); new LibsBuilder().withLicenseShown(true).withVersionShown(true) .withActivityStyle(Libs.ActivityStyle.DARK).withAboutVersionShown(true) .withActivityTitle(getString(R.string.app_name)).withAboutIconShown(true) .withListener(libsListener).start(MainActivity.this); break; case 9: mTracker.send(new HitBuilders.EventBuilder().setCategory("Action") .setAction("Translate").build()); Intent translate = new Intent(Intent.ACTION_VIEW, Uri.parse("https://poeditor.com/join/project/AZQxDV2440")); startActivity(translate); break; default: break; } } else { flag = false; } return flag; } }).withSavedInstance(savedInstanceState).build(); AppUpdater appUpdater = new AppUpdater(this); appUpdater.start(); final DirectoryChooserConfig config = DirectoryChooserConfig.builder() .allowNewDirectoryNameModification(true).newDirectoryName("CfBCamera") .initialDirectory( sharedPreferences.getString("pic_location", "/storage/emulated/0/CompanionForBand/Camera")) .build(); mDialog = DirectoryChooserFragment.newInstance(config); new BandUtils().execute(); CustomActivityOnCrash.install(this); }
From source file:com.etalio.android.EtalioBase.java
protected String getEtalioUserAgent() { Locale locale = Locale.getDefault(); Resources resources;/* w w w. j ava2 s .c om*/ resources = mContext.getApplicationContext().getResources(); return "Etalio/" + getVersion() + " (Linux; " + " Android " + Build.VERSION.RELEASE + "; " + locale.toString() + "; " + Build.MANUFACTURER + " " + Build.MODEL + " Build/" + Build.DISPLAY + "; " + " Density/" + (resources != null ? resources.getDisplayMetrics().density : "unknown") + ")"; }
From source file:com.silentcircle.accounts.AccountStep3.java
private void startLoadingRegisterDevice() { JSONObject data = null;/*from www.j a v a 2s . c o m*/ // Setup other JSON and fill it with data we need for device provisioning if (mParent == null || mParent.getJsonHolder() == null) return; String hwDeviceId = Utilities.hashMd5(TiviPhoneService.getHwDeviceId(mParent)); if (ConfigurationUtilities.mTrace) Log.d(TAG, "Hardware device id: " + hwDeviceId); try { final String deviceName = Build.MODEL; data = new JSONObject(mParent.getJsonHolder(), new String[] { "username" }); data.put("password", mParent.getJsonHolder().getString(mUseExistingAccount ? "current_password" : "password")); data.put("device_name", deviceName); data.put("persistent_device_id", hwDeviceId); data.put("app", "silent_phone"); data.put("device_class", "android"); data.put("version", BuildConfig.SPA_BUILD_NUMBER); if (!TextUtils.isEmpty(mAuthToken.getText())) data.put("tfa_code", mAuthToken.getText()); } catch (JSONException ignore) { } showProgressBar(); LoaderTaskRegisterDevice loaderTask = new LoaderTaskRegisterDevice(data); loaderTask.execute(); }
From source file:ca.mymenuapp.ui.debug.DebugAppContainer.java
private void setupDeviceSection() { DisplayMetrics displayMetrics = activity.getResources().getDisplayMetrics(); String densityBucket = getDensityString(displayMetrics); deviceMakeView.setText(Strings.truncateAt(Build.MANUFACTURER, 20)); deviceModelView.setText(Strings.truncateAt(Build.MODEL, 20)); deviceResolutionView.setText(displayMetrics.heightPixels + "x" + displayMetrics.widthPixels); deviceDensityView.setText(displayMetrics.densityDpi + "dpi (" + densityBucket + ")"); deviceReleaseView.setText(Build.VERSION.RELEASE); deviceApiView.setText(String.valueOf(Build.VERSION.SDK_INT)); }
From source file:util.Utils.java
/** * ?? * * @return */ public static String getDeviceModel() { return Build.MODEL; }
From source file:com.davidmascharka.lips.MainActivity.java
private void resetDatafile() { File root = Environment.getExternalStorageDirectory(); File dir = new File(root.getAbsolutePath() + "/indoor_localization"); dir.mkdirs();/*from w w w. j a v a2 s . co m*/ File file = new File(dir, "dataset_" + building + ".txt"); try { FileOutputStream outputStream = new FileOutputStream(file); PrintWriter writer = new PrintWriter(outputStream); writer.println("%Data collected by " + android.os.Build.MODEL + "\n%Format of data: Accelerometer X, Accelerometer Y, Accelerometer Z, " + "Magnetic X, Magnetic Y, Magnetic Z, Light, Rotation X, Rotation Y, " + "Rotation Z, Orientation X, Orientation Y, Orientation Z, WIFI NETWORKS " + "BSSID, Frequency, Signal level, Latitude, Longitude\n\n"); writer.flush(); writer.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:org.zeroxlab.zeroxbenchmark.Benchmark.java
public String getXMLResult() { if (mCases.size() == 0) return ""; Date date = new Date(); //2010-05-28T17:40:25CST SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz"); String xml = ""; xml += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; xml += "<result"; xml += " executedTimestamp=\"" + sdf.format(date) + "\""; xml += " manufacturer=\"" + Build.MANUFACTURER.replace(' ', '_') + "\""; xml += " model=\"" + Build.MODEL.replace(' ', '_') + ":" + Build.DISPLAY + "\""; xml += " buildTimestamp=\"" + sdf.format(new Date(Build.TIME)) + "\""; xml += " orientation=\"" + Integer.toString(orientation) + "\""; try { // read kernel version BufferedReader procVersion = new BufferedReader(new FileReader("/proc/version")); StringBuffer sbuff = new StringBuffer(); String tmp;/*from www . j ava 2s.c o m*/ while ((tmp = procVersion.readLine()) != null) sbuff.append(tmp); procVersion.close(); tmp = sbuff.toString().replace("[\n\r]+", " ").replace(" +", "."); xml += " version=\"" + tmp + "\""; } catch (IOException e) { Log.e(TAG, "opening /proc/version failed: " + e.toString()); } try { // read and parse cpu info BufferedReader procVersion = new BufferedReader(new FileReader("/proc/cpuinfo")); StringBuffer sbuff = new StringBuffer(); String tmp; while ((tmp = procVersion.readLine()) != null) sbuff.append(tmp + "\n"); procVersion.close(); tmp = sbuff.toString(); sbuff = new StringBuffer(); Pattern p1 = Pattern.compile("(Processor\\s*:\\s*(.*)\\s*[\n\r]+)"); Matcher m1 = p1.matcher(tmp); if (m1.find()) sbuff.append(m1.group(2)); Pattern p2 = Pattern.compile("(Hardware\\s*:\\s*(.*)\\s*[\n\r]+)"); Matcher m2 = p2.matcher(tmp); if (m2.find()) sbuff.append(":" + m2.group(2)); Pattern p3 = Pattern.compile("(Revision\\s*:\\s*(.*)\\s*[\n\r]+)"); Matcher m3 = p3.matcher(tmp); if (m3.find()) sbuff.append(":" + m3.group(2)); Log.e(TAG, sbuff.toString()); xml += " cpu=\"" + sbuff.toString() + "\""; } catch (IOException e) { Log.e(TAG, "opening /proc/version failed: " + e.toString()); } xml += ">"; Case mycase; for (int i = 0; i < mCases.size(); i++) { mycase = mCases.get(i); xml += mycase.getXMLBenchmark(); } xml += "</result>"; return xml; }