List of usage examples for android.os Build MANUFACTURER
String MANUFACTURER
To view the source code for android.os Build MANUFACTURER.
Click Source Link
From source file:nl.nikhef.eduroam.WiFiEduroam.java
private void postData(String username, String password, String csr) throws RuntimeException { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(CONF_HTTP_URL); String android_id = Secure.getString(getBaseContext().getContentResolver(), Secure.ANDROID_ID); try {//from w w w . ja va2 s . c o m // Add the post data List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("username", username)); nameValuePairs.add(new BasicNameValuePair("password", password)); nameValuePairs.add(new BasicNameValuePair("csr", csr)); nameValuePairs.add(new BasicNameValuePair("device_id", android_id)); nameValuePairs.add(new BasicNameValuePair("device_serial", android.os.Build.SERIAL)); nameValuePairs.add(new BasicNameValuePair("device_description", android.os.Build.MANUFACTURER + " " + android.os.Build.MODEL + " / " + android.os.Build.PRODUCT)); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); // Execute HTTP POST request synchronously HttpResponse response = httpclient.execute(httppost); if (!response.getStatusLine().toString().endsWith("200 OK")) { updateStatus("HTTP Error: " + response.getStatusLine()); } // Convert input to JSON object BufferedReader reader = new BufferedReader( new InputStreamReader(response.getEntity().getContent(), "UTF-8")); StringBuilder builder = new StringBuilder(); for (String line = null; (line = reader.readLine()) != null;) { builder.append(line).append("\n"); } String json = builder.toString(); JSONObject obj = new JSONObject(json); if (!obj.getString("status").equals("ok")) { updateStatus("JSON Status Error: " + obj.getString("error")); throw new RuntimeException(obj.getString("error")); } // Grab the information certificate = obj.getString("certificate"); ca = obj.getString("ca"); ca_name = obj.getString("ca_name"); realm = obj.getString("realm"); subject_match = obj.getString("subject_match"); ssid = obj.getString("ssid"); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); throw new RuntimeException("Please check your connection!"); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { throw new RuntimeException("JSON: " + e.getMessage()); } }
From source file:org.alfresco.mobile.android.application.managers.ActionUtils.java
public static boolean actionSendFeedbackEmail(Fragment fr) { try {//from w w w. java 2 s . c o m ShareCompat.IntentBuilder iBuilder = ShareCompat.IntentBuilder.from(fr.getActivity()); Context context = fr.getContext(); // Email iBuilder.addEmailTo(context.getResources() .getStringArray(org.alfresco.mobile.android.foundation.R.array.bugreport_email)); // Prepare Subject String versionName = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; int versionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; String subject = "Alfresco Android Mobile Feedback"; iBuilder.setSubject(subject); // Content DisplayMetrics dm = context.getResources().getDisplayMetrics(); String densityBucket = getDensityString(dm); Map<String, String> info = new LinkedHashMap<>(); info.put("Version", versionName); info.put("Version code", Integer.toString(versionCode)); info.put("Make", Build.MANUFACTURER); info.put("Model", Build.MODEL); info.put("Resolution", dm.heightPixels + "x" + dm.widthPixels); info.put("Density", dm.densityDpi + "dpi (" + densityBucket + ")"); info.put("Release", Build.VERSION.RELEASE); info.put("API", String.valueOf(Build.VERSION.SDK_INT)); info.put("Language", context.getResources().getConfiguration().locale.getDisplayLanguage()); StringBuilder builder = new StringBuilder(); builder.append("\n\n\n\n"); builder.append("Alfresco Mobile and device details\n"); builder.append("-------------------\n").toString(); for (Map.Entry entry : info.entrySet()) { builder.append(entry.getKey()).append(": ").append(entry.getValue()).append('\n'); } builder.append("-------------------\n\n").toString(); iBuilder.setType("message/rfc822"); iBuilder.setText(builder.toString()); iBuilder.setChooserTitle(fr.getString(R.string.settings_feedback_email)).startChooser(); return true; } catch (Exception e) { AlfrescoNotificationManager.getInstance(fr.getActivity()).showAlertCrouton(fr.getActivity(), R.string.error_general); Log.d(TAG, Log.getStackTraceString(e)); } return false; }
From source file:com.almalence.opencam.Fragment.java
@TargetApi(13) private void showCameraParameters() { AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity()); alertDialog.setTitle(R.string.Pref_CameraParameters_Title); final StringBuilder about_string = new StringBuilder(); String version = "UNKNOWN_VERSION"; int version_code = -1; try {/* ww w .j a v a 2 s. c om*/ PackageInfo pInfo = getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(), 0); version = pInfo.versionName; version_code = pInfo.versionCode; } catch (NameNotFoundException e) { e.printStackTrace(); } about_string.append("\nApplication name: "); about_string.append(MainScreen.getInstance().getResources().getString(R.string.Pref_About)); about_string.append("\nAndroid API version: "); about_string.append(Build.VERSION.SDK_INT); about_string.append("\nDevice manufacturer: "); about_string.append(Build.MANUFACTURER); about_string.append("\nDevice model: "); about_string.append(Build.MODEL); about_string.append("\nDevice code-name: "); about_string.append(Build.HARDWARE); about_string.append("\nDevice variant: "); about_string.append(Build.DEVICE); { ActivityManager activityManager = (ActivityManager) getActivity() .getSystemService(Activity.ACTIVITY_SERVICE); about_string.append("\nStandard max heap (MB): "); about_string.append(activityManager.getMemoryClass()); about_string.append("\nLarge max heap (MB): "); about_string.append(activityManager.getLargeMemoryClass()); } { Point display_size = new Point(); Display display = getActivity().getWindowManager().getDefaultDisplay(); display.getSize(display_size); about_string.append("\nDisplay size: "); about_string.append(display_size.x); about_string.append("x"); about_string.append(display_size.y); } //show camera 2 support level int level = CameraController.getCamera2Level(); about_string.append("\nCamera2 API: "); switch (level) { case 0://limited about_string.append("limited"); break; case 1://full about_string.append("full"); break; case 2://legacy about_string.append("legacy"); break; default: about_string.append("not supported"); } // about_string.append("\nSensor orientation, back camera: "); // about_string.append(CameraController.getSensorOrientation(0)); // about_string.append("\nSensor orientation, front camera: "); // about_string.append(CameraController.getSensorOrientation(1)); if (MainScreen.getInstance().preview_sizes != null) { about_string.append("\nPreview resolutions: "); for (int i = 0; i < MainScreen.getInstance().preview_sizes.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().preview_sizes.get(i).getWidth()); about_string.append("x"); about_string.append(MainScreen.getInstance().preview_sizes.get(i).getHeight()); } } about_string.append("\nCurrent camera ID: "); about_string.append(MainScreen.getInstance().cameraId); if (MainScreen.getInstance().picture_sizes != null) { about_string.append("\nPhoto resolutions: "); for (int i = 0; i < MainScreen.getInstance().picture_sizes.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().picture_sizes.get(i).getWidth()); about_string.append("x"); about_string.append(MainScreen.getInstance().picture_sizes.get(i).getHeight()); } } if (MainScreen.getInstance().video_sizes != null) { about_string.append("\nVideo resolutions: "); for (int i = 0; i < MainScreen.getInstance().video_sizes.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().video_sizes.get(i).getWidth()); about_string.append("x"); about_string.append(MainScreen.getInstance().video_sizes.get(i).getHeight()); } } about_string.append("\nVideo stabilization: "); about_string.append(MainScreen.getInstance().supports_video_stabilization ? "true" : "false"); about_string.append("\nFlash modes: "); if (MainScreen.getInstance().flash_values != null && MainScreen.getInstance().flash_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().flash_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().flash_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nFocus modes: "); if (MainScreen.getInstance().focus_values != null && MainScreen.getInstance().focus_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().focus_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().focus_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nScene modes: "); if (MainScreen.getInstance().scene_modes_values != null && MainScreen.getInstance().scene_modes_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().scene_modes_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().scene_modes_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nWhite balances: "); if (MainScreen.getInstance().white_balances_values != null && MainScreen.getInstance().white_balances_values.size() > 0) { for (int i = 0; i < MainScreen.getInstance().white_balances_values.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().white_balances_values.get(i)); } } else { about_string.append("None"); } about_string.append("\nISOs: "); if (MainScreen.getInstance().isos != null && MainScreen.getInstance().isos.size() > 0) { for (int i = 0; i < MainScreen.getInstance().isos.size(); i++) { if (i > 0) { about_string.append(", "); } about_string.append(MainScreen.getInstance().isos.get(i)); } } else { about_string.append("None"); } String save_location = SavingService.getSaveToPath(); about_string.append("\nSave Location: " + save_location); if (MainScreen.getInstance().flattenParamteters != null && !MainScreen.getInstance().flattenParamteters.equals("")) { about_string.append("\nFULL INFO:\n"); about_string.append(MainScreen.getInstance().flattenParamteters); } alertDialog.setMessage(about_string); alertDialog.setPositiveButton(R.string.Pref_CameraParameters_Ok, null); alertDialog.setNegativeButton(R.string.Pref_CameraParameters_CopyToClipboard, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { ClipboardManager clipboard = (ClipboardManager) getActivity() .getSystemService(Activity.CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("OpenCamera About", about_string); clipboard.setPrimaryClip(clip); } }); alertDialog.show(); }
From source file:edu.pdx.cecs.orcycle.MyApplication.java
private void loadDeviceInfo() { // Determine application information versionName = ""; versionCode = 0;//from ww w.j a va2 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();/* ww w.j av a 2s. 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;//from w ww .j a v a 2s. c o m 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: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: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;// w ww . j a v a 2 s. 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; }
From source file:com.indoorsy.frash.easemob.activity.ChatActivity.java
private String getPhoneInfo() { String language = Locale.getDefault().getLanguage(); String phoneVersion = android.os.Build.VERSION.RELEASE; String xinghao = android.os.Build.MODEL; String firm = android.os.Build.MANUFACTURER; String versionName = null;/* w w w . j a v a 2 s .co m*/ try { versionName = getVersionName(); } catch (Exception e) { e.printStackTrace(); } String st = "{'clientLanguage':'" + language + "','clientVersion':'" + versionName + "','manufacturer':'" + firm + "','model':'" + xinghao + "','systemVersion':'" + phoneVersion + "'}"; return st; }
From source file:com.chummy.jezebel.material.dark.activities.Main.java
@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case R.id.share: Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); String shareBody = "Check out " + getResources().getString(R.string.theme_name) + " by " + getResources().getString(R.string.nicholas_short) + "!\n\nDownload it here!: " + getResources().getString(R.string.play_store_link); sharingIntent.putExtra(Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, (getResources().getString(R.string.share_title)))); break;/*from w w w . j a va 2 s. com*/ case R.id.sendemail: StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:" + getResources().getString(R.string.email_id))); if (!isAppInstalled("org.cyanogenmod.theme.chooser")) { if (!isAppInstalled("com.cyngn.theme.chooser")) { if (!isAppInstalled("com.lovejoy777.rroandlayersmanager")) { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject)); } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_rro)); } } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_cos)); } } else { intent.putExtra(Intent.EXTRA_SUBJECT, getResources().getString(R.string.email_subject_cm)); } emailBuilder.append("\n \n \nOS Version: " + System.getProperty("os.version") + "(" + Build.VERSION.INCREMENTAL + ")"); emailBuilder.append("\nOS API Level: " + Build.VERSION.SDK_INT + " (" + Build.VERSION.RELEASE + ") " + "[" + Build.ID + "]"); emailBuilder.append("\nDevice: " + Build.DEVICE); emailBuilder.append("\nManufacturer: " + Build.MANUFACTURER); emailBuilder.append("\nModel (and Product): " + Build.MODEL + " (" + Build.PRODUCT + ")"); if (!isAppInstalled("org.cyanogenmod.theme.chooser")) { if (!isAppInstalled("com.cyngn.theme.chooser")) { if (!isAppInstalled("com.lovejoy777.rroandlayersmanager")) { emailBuilder.append("\nTheme Engine: Not Available"); } else { emailBuilder.append("\nTheme Engine: Layers Manager (RRO)"); } } else { emailBuilder.append("\nTheme Engine: Cyanogen OS Theme Engine"); } } else { emailBuilder.append("\nTheme Engine: CyanogenMod Theme Engine"); } PackageInfo appInfo = null; try { appInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } emailBuilder.append("\nApp Version Name: " + appInfo.versionName); emailBuilder.append("\nApp Version Code: " + appInfo.versionCode); intent.putExtra(Intent.EXTRA_TEXT, emailBuilder.toString()); startActivity(Intent.createChooser(intent, (getResources().getString(R.string.send_title)))); break; case R.id.changelog: changelog(); break; case R.id.hide_launcher: boolean checked = item.isChecked(); if (!checked) { new MaterialDialog.Builder(this).title(R.string.warning).content(R.string.hide_action) .positiveText(R.string.nice).show(); } item.setChecked(!checked); setLauncherIconEnabled(checked); return true; default: return super.onOptionsItemSelected(item); } return true; }