List of usage examples for android.os Build PRODUCT
String PRODUCT
To view the source code for android.os Build PRODUCT.
Click Source Link
From source file:com.pimp.companionforband.activities.main.MainActivity.java
@Override public void onNegativeReview(int stars) { StringBuilder emailBuilder = new StringBuilder(); Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:pimplay69@gmail.com")); intent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.feedback) + " : " + 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;//from w w w .j a v a 2s . com 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")); }
From source file:com.bt.download.android.gui.Librarian.java
public Finger finger(boolean local) { Finger finger = new Finger(); finger.uuid = ConfigurationManager.instance().getUUIDString(); finger.nickname = ConfigurationManager.instance().getNickname(); finger.frostwireVersion = Constants.FROSTWIRE_VERSION_STRING; finger.totalShared = getNumFiles();// w w w. j a va2s. c o m finger.deviceVersion = Build.VERSION.RELEASE; finger.deviceModel = Build.MODEL; finger.deviceProduct = Build.PRODUCT; finger.deviceName = Build.DEVICE; finger.deviceManufacturer = Build.MANUFACTURER; finger.deviceBrand = Build.BRAND; finger.deviceScreen = readScreenMetrics(); finger.numSharedAudioFiles = getNumFiles(Constants.FILE_TYPE_AUDIO, true); finger.numSharedVideoFiles = getNumFiles(Constants.FILE_TYPE_VIDEOS, true); finger.numSharedPictureFiles = getNumFiles(Constants.FILE_TYPE_PICTURES, true); finger.numSharedDocumentFiles = getNumFiles(Constants.FILE_TYPE_DOCUMENTS, true); finger.numSharedApplicationFiles = getNumFiles(Constants.FILE_TYPE_APPLICATIONS, true); finger.numSharedRingtoneFiles = getNumFiles(Constants.FILE_TYPE_RINGTONES, true); if (local) { finger.numTotalAudioFiles = getNumFiles(Constants.FILE_TYPE_AUDIO, false); finger.numTotalVideoFiles = getNumFiles(Constants.FILE_TYPE_VIDEOS, false); finger.numTotalPictureFiles = getNumFiles(Constants.FILE_TYPE_PICTURES, false); finger.numTotalDocumentFiles = getNumFiles(Constants.FILE_TYPE_DOCUMENTS, false); finger.numTotalApplicationFiles = getNumFiles(Constants.FILE_TYPE_APPLICATIONS, false); finger.numTotalRingtoneFiles = getNumFiles(Constants.FILE_TYPE_RINGTONES, false); } else { finger.numTotalAudioFiles = finger.numSharedAudioFiles; finger.numTotalVideoFiles = finger.numSharedVideoFiles; finger.numTotalPictureFiles = finger.numSharedPictureFiles; finger.numTotalDocumentFiles = finger.numSharedDocumentFiles; finger.numTotalApplicationFiles = finger.numSharedApplicationFiles; finger.numTotalRingtoneFiles = finger.numSharedRingtoneFiles; } return finger; }
From source file:de.schildbach.wallet.ui.ReportIssueDialogFragment.java
private 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(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? supportedAbisLollipop() : supportedAbisKitKat())) .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(/* ww w .j a va 2 s .c o m*/ "Memory Class: " + activityManager.getMemoryClass() + "/" + activityManager.getLargeMemoryClass() + (activityManager.isLowRamDevice() ? " (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.cc.signalinfo.activities.MainActivity.java
/** * Set the phone model, OS version, carrier name on the screen *//*w w w . j av a 2s.co m*/ private void setPhoneInfo() { setTextViewText(R.id.deviceName, String.format("%s %s", Build.MANUFACTURER, Build.MODEL)); setTextViewText(R.id.deviceModel, String.format("%s/%s (%s) ", Build.PRODUCT, Build.DEVICE, Build.ID)); setTextViewText(R.id.androidVersion, String.format(getString(R.string.androidVersion), Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); setTextViewText(R.id.carrierName, tm.getNetworkOperatorName()); setTextViewText(R.id.buildHost, Build.HOST); setNetworkTypeText(); }
From source file:at.alladin.rmbt.android.util.InformationCollector.java
private void getClientInfo() { final String tmpuuid = ConfigHelper.getUUID(context); if (tmpuuid == null || tmpuuid.length() == 0) fullInfo.setProperty("UUID", ""); else// ww w .j a v a2s . co m fullInfo.setProperty("UUID", tmpuuid); fullInfo.setProperty("PLATTFORM", PLATTFORM_NAME); fullInfo.setProperty("OS_VERSION", android.os.Build.VERSION.RELEASE + "(" + android.os.Build.VERSION.INCREMENTAL + ")"); fullInfo.setProperty("API_LEVEL", String.valueOf(android.os.Build.VERSION.SDK_INT)); fullInfo.setProperty("DEVICE", android.os.Build.DEVICE); fullInfo.setProperty("MODEL", android.os.Build.MODEL); fullInfo.setProperty("PRODUCT", android.os.Build.PRODUCT); fullInfo.setProperty("NETWORK_TYPE", String.valueOf(getNetwork())); if (connManager != null) { final NetworkInfo activeNetworkInfo = connManager.getActiveNetworkInfo(); if (activeNetworkInfo != null) fullInfo.setProperty("TELEPHONY_NETWORK_IS_ROAMING", String.valueOf(activeNetworkInfo.isRoaming())); } PackageInfo pInfo; String clientVersion = ""; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); clientVersion = pInfo.versionName; } catch (final NameNotFoundException e) { // e1.printStackTrace(); Log.e(DEBUG_TAG, "version of the application cannot be found", e); } fullInfo.setProperty("CLIENT_NAME", Config.RMBT_CLIENT_NAME); fullInfo.setProperty("CLIENT_SOFTWARE_VERSION", clientVersion); }
From source file:org.akvo.caddisfly.helper.TestConfigHelper.java
private static JSONObject getDeviceDetails() throws JSONException { JSONObject details = new JSONObject(); details.put("model", Build.MODEL); details.put("product", Build.PRODUCT); details.put("manufacturer", Build.MANUFACTURER); details.put("os", "Android - " + Build.VERSION.RELEASE + " (" + Build.VERSION.SDK_INT + ")"); details.put("country", Locale.getDefault().getCountry()); details.put("language", Locale.getDefault().getLanguage()); return details; }
From source file:com.www.avtovokzal.org.MainActivity.java
private void sendPhoneInformationToServer() { String version = null;/*from ww w . j a v a 2 s .c o m*/ PackageInfo packageInfo = null; try { packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } String manufacturer = Uri.encode(Build.MANUFACTURER); String model = Uri.encode(Build.MODEL); String device = Uri.encode(Build.DEVICE); String board = Uri.encode(Build.BOARD); String brand = Uri.encode(Build.BRAND); String display = Uri.encode(Build.DISPLAY); String id = Uri.encode(Build.ID); String product = Uri.encode(Build.PRODUCT); String release = Uri.encode(Build.VERSION.RELEASE); if (packageInfo != null) { version = Uri.encode(packageInfo.versionName); } if (Constants.LOG_ON) { Log.v(TAG, "1: " + manufacturer + " 2: " + model + " 3: " + device + " 4: " + board + " 5: " + brand + " 6: " + display + " 7: " + id + " 8: " + product + " 9: " + release + " 10: " + version); } String url = "http://www.avtovokzal.org/php/app/sendPhoneInformation.php?manufacturer=" + manufacturer + "&model=" + model + "&device=" + device + "&board=" + board + "&brand=" + brand + "&display=" + display + "&build_id=" + id + "&product=" + product + "&release_number=" + release + "&version=" + version; if (isOnline()) { StringRequest strReq = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() { @Override public void onResponse(String response) { } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (Constants.LOG_ON) VolleyLog.d(TAG, "Error: " + error.getMessage()); } }); // ? TimeOut, Retry strReq.setRetryPolicy(new DefaultRetryPolicy(DefaultRetryPolicy.DEFAULT_TIMEOUT_MS, 3, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT)); // ? ? AppController.getInstance().addToRequestQueue(strReq); } else { callErrorActivity(); } }
From source file:at.alladin.rmbt.android.util.InformationCollector.java
public static JSONObject fillBasicInfo(JSONObject object, Context ctx) throws JSONException { object.put("plattform", PLATTFORM_NAME); object.put("os_version", android.os.Build.VERSION.RELEASE + "(" + android.os.Build.VERSION.INCREMENTAL + ")"); object.put("api_level", String.valueOf(android.os.Build.VERSION.SDK_INT)); object.put("device", android.os.Build.DEVICE); object.put("model", android.os.Build.MODEL); object.put("product", android.os.Build.PRODUCT); object.put("language", Locale.getDefault().getLanguage()); object.put("timezone", TimeZone.getDefault().getID()); object.put("softwareRevision", RevisionHelper.getVerboseRevision()); PackageInfo pInfo = getPackageInfo(ctx); if (pInfo != null) { object.put("softwareVersionCode", pInfo.versionCode); object.put("softwareVersionName", pInfo.versionName); }/*from w w w .j av a2 s . c om*/ object.put("type", at.alladin.rmbt.android.util.Config.RMBT_CLIENT_TYPE); if (BASIC_INFORMATION_INCLUDE_LOCATION) { Location loc = GeoLocation.getLastKnownLocation(ctx); if (loc != null) { JSONObject locationJson = new JSONObject(); locationJson.put("lat", loc.getLatitude()); locationJson.put("long", loc.getLongitude()); locationJson.put("provider", loc.getProvider()); if (loc.hasSpeed()) locationJson.put("speed", loc.getSpeed()); if (loc.hasAltitude()) locationJson.put("altitude", loc.getAltitude()); locationJson.put("age", System.currentTimeMillis() - loc.getTime()); //getElapsedRealtimeNanos() would be better, but require higher API-level if (loc.hasAccuracy()) locationJson.put("accuracy", loc.getAccuracy()); if (loc.hasSpeed()) locationJson.put("speed", loc.getSpeed()); /* * would require API level 18 if (loc.isFromMockProvider()) locationJson.put("mock",loc.isFromMockProvider()); */ object.put("location", locationJson); } } InformationCollector infoCollector = null; if (ctx instanceof RMBTMainActivity) { Fragment curFragment = ((RMBTMainActivity) ctx).getCurrentFragment(); if (curFragment != null) { if (curFragment instanceof RMBTMainMenuFragment) { infoCollector = ((RMBTMainMenuFragment) curFragment).getInformationCollector(); } } } if (BASIC_INFORMATION_INCLUDE_LAST_SIGNAL_ITEM && (infoCollector != null)) { SignalItem signalItem = infoCollector.getLastSignalItem(); if (signalItem != null) { object.put("last_signal_item", signalItem.toJson()); } else { object.put("last_signal_item", JSONObject.NULL); } } return object; }
From source file:com.chummy.jezebel.material.dark.activities.Main.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); context = this; mPrefs = new Preferences(Main.this); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar);/*from ww w . j a v a2 s. c om*/ getSupportActionBar().setDisplayHomeAsUpEnabled(true); thaApp = getResources().getString(R.string.app_name); thaHome = getResources().getString(R.string.section_one); thaPreviews = getResources().getString(R.string.section_two); thaApply = getResources().getString(R.string.section_three); thaWalls = getResources().getString(R.string.section_four); thaRequest = getResources().getString(R.string.section_five); thaCredits = getResources().getString(R.string.section_seven); thaTesters = getResources().getString(R.string.section_eight); thaWhatIsThemed = getResources().getString(R.string.section_nine); thaContactUs = getResources().getString(R.string.section_ten); thaLogcat = getResources().getString(R.string.section_eleven); thaFAQ = getResources().getString(R.string.section_twelve); thaHelp = getResources().getString(R.string.section_thirteen); thaAbout = getResources().getString(R.string.section_fourteen); thaIconPack = getResources().getString(R.string.section_fifteen); thaFullChangelog = getResources().getString(R.string.section_sixteen); thaRebuild = getResources().getString(R.string.section_seventeen); drawerVersion = getResources().getString(R.string.version_code); currentItem = 1; headerResult = new AccountHeader().withActivity(this).withHeaderBackground(R.drawable.header) .withSelectionFirstLine(getResources().getString(R.string.app_name)) .withSelectionSecondLine(drawerVersion).withSavedInstance(savedInstanceState).withHeightDp(120) .build(); enable_features = mPrefs.isFeaturesEnabled(); firstrun = mPrefs.isFirstRun(); result = new Drawer().withActivity(this).withToolbar(toolbar).withAccountHeader(headerResult) .withHeaderDivider(false).withDrawerWidthDp(400) .addDrawerItems(new SectionDrawerItem().withName("Main"), new PrimaryDrawerItem().withName(thaHome).withIcon(GoogleMaterial.Icon.gmd_home) .withIdentifier(1), new PrimaryDrawerItem().withName(thaIconPack) .withIcon(GoogleMaterial.Icon.gmd_picture_in_picture) .withDescription("This applies icon pack 'Whicons'.").withCheckable(false) .withIdentifier(11), new PrimaryDrawerItem().withName(thaFullChangelog) .withIcon(GoogleMaterial.Icon.gmd_wrap_text) .withDescription("Complete changelog of Dark Material.").withCheckable(false) .withIdentifier(12), new DividerDrawerItem(), new SectionDrawerItem().withName("Information"), new PrimaryDrawerItem().withName(thaAbout).withIcon(GoogleMaterial.Icon.gmd_info_outline) .withDescription("Basic information on the theme.").withIdentifier(10), new PrimaryDrawerItem().withName(thaWhatIsThemed).withIcon(GoogleMaterial.Icon.gmd_warning) .withDescription("List of overlaid applications.").withIdentifier(3), new PrimaryDrawerItem().withName(thaFAQ).withIcon(GoogleMaterial.Icon.gmd_question_answer) .withDescription("Common questions with answers.").withIdentifier(8), new DividerDrawerItem(), new SectionDrawerItem().withName("Tools & Utilities"), new PrimaryDrawerItem().withName(thaRebuild).withIcon(GoogleMaterial.Icon.gmd_sync) .withDescription("A rebuild a day keeps the RRs away!").withCheckable(false) .withBadge("ROOT ").withIdentifier(13), new PrimaryDrawerItem().withName(thaLogcat).withIcon(GoogleMaterial.Icon.gmd_bug_report) .withDescription("System level log recording.").withCheckable(false) .withBadge("ROOT ").withIdentifier(7), new DividerDrawerItem(), new SectionDrawerItem().withName("The Developers"), new PrimaryDrawerItem().withName(thaCredits).withIcon(GoogleMaterial.Icon.gmd_people) .withDescription("chummy development team").withIdentifier(5), new PrimaryDrawerItem().withName(thaTesters).withIcon(GoogleMaterial.Icon.gmd_star) .withDescription("The people who keep the team updated.").withIdentifier(4), new DividerDrawerItem(), new SectionDrawerItem().withName("Contact"), new SecondaryDrawerItem().withName(thaContactUs).withIcon(GoogleMaterial.Icon.gmd_mail) .withCheckable(false).withIdentifier(6), new SecondaryDrawerItem().withName(thaHelp).withIcon(GoogleMaterial.Icon.gmd_help) .withCheckable(true).withIdentifier(9)) .withOnDrawerItemClickListener(new Drawer.OnDrawerItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id, IDrawerItem drawerItem) { if (drawerItem != null) { switch (drawerItem.getIdentifier()) { case 1: switchFragment(1, thaApp, "Home"); break; case 2: ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); boolean isConnected = activeNetwork != null && activeNetwork.isConnectedOrConnecting(); if (isConnected) { switchFragment(2, thaWalls, "Wallpapers"); } else { showNotConnectedDialog(); } break; case 3: switchFragment(3, thaWhatIsThemed, "WhatIsThemed"); break; case 4: switchFragment(4, thaTesters, "Testers"); break; case 5: switchFragment(5, thaCredits, "Credits"); break; case 6: 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 7: if (Shell.SU.available()) { if (!isAppInstalled("com.tooleap.logcat")) { if (!isAppInstalled("com.nolanlawson.logcat")) { Intent logcat = new Intent(Intent.ACTION_VIEW, Uri.parse( getResources().getString(R.string.play_store_link_logcat))); startActivity(logcat); } else { Intent intent_logcat = getPackageManager() .getLaunchIntentForPackage("com.nolanlawson.logcat"); Toast toast = Toast.makeText(getApplicationContext(), getResources().getString(R.string.logcat_toast), Toast.LENGTH_LONG); toast.show(); startActivity(intent_logcat); } } else { Intent intent_tooleap = getPackageManager() .getLaunchIntentForPackage("com.tooleap.logcat"); Toast toast = Toast.makeText(getApplicationContext(), getResources().getString(R.string.logcat_toast), Toast.LENGTH_LONG); toast.show(); startActivity(intent_tooleap); } } else { Toast toast = Toast.makeText(getApplicationContext(), "Unfortunately, this feature is only available for root users.", Toast.LENGTH_LONG); toast.show(); } break; case 8: switchFragment(8, thaFAQ, "FAQ"); break; case 9: switchFragment(9, thaHelp, "Help"); break; case 10: switchFragment(10, thaAbout, "About"); break; case 11: Intent launch_whicons = new Intent("android.intent.action.MAIN"); launch_whicons.setComponent(new ComponentName("org.cyanogenmod.theme.chooser", "org.cyanogenmod.theme.chooser.ChooserActivity")); launch_whicons.putExtra("pkgName", "com.whicons.iconpack"); Intent launch_whicons_cos = new Intent("android.intent.action.MAIN"); launch_whicons_cos.setComponent(new ComponentName("com.cyngn.theme.chooser", "com.cyngn.theme.chooser.ChooserActivity")); launch_whicons_cos.putExtra("pkgName", "com.whicons.iconpack"); Intent devPlay = new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.play_store_whicons))); Intent intent_whicons = getPackageManager() .getLaunchIntentForPackage("com.whicons.iconpack"); if (intent_whicons == null) { startActivity(devPlay); } else { if (isAppInstalled("org.cyanogenmod.theme.chooser")) { startActivity(launch_whicons); } else { if (isAppInstalled("com.cyngn.theme.chooser")) { Toast toast = Toast.makeText(getApplicationContext(), "Select Dark Material, click Customize and locate Default Icons. Then select Whicons and click Apply.", Toast.LENGTH_LONG); toast.show(); startActivity(launch_whicons_cos); } else { startActivity(intent_whicons); } } } break; case 12: fullchangelog(); break; case 13: if (Shell.SU.available()) { rebuildThemeCache(); } else { Toast toast = Toast.makeText(getApplicationContext(), "Unfortunately, this feature is only available for root users.", Toast.LENGTH_LONG); toast.show(); } break; } } } }).withSavedInstance(savedInstanceState).build(); result.getListView().setVerticalScrollBarEnabled(false); // Check for permissions first so that we don't have any issues down the road int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE); if (permissionCheck == PackageManager.PERMISSION_GRANTED) { // permission already granted, allow the program to continue running runLicenseChecker(); } else { // permission not granted, request it from the user ActivityCompat.requestPermissions(this, new String[] { android.Manifest.permission.WRITE_EXTERNAL_STORAGE }, PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE); } if (savedInstanceState == null) { result.setSelectionByIdentifier(1); } }
From source file:com.google.mist.plot.MainActivity.java
private void dumpSystemInfo() { File dataDir = getOrCreateSessionDir(); File target = new File(dataDir, "system_info.txt"); // Only write system info once. if (target.exists()) { return;//from w w w. j a va 2 s.com } try { Display display = getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); FileWriter fw = new FileWriter(target, true); fw.write(String.format("Build.DEVICE: %s\n", Build.DEVICE)); fw.write(String.format("Build.MODEL: %s\n", Build.MODEL)); fw.write(String.format("Build.PRODUCT: %s\n", Build.PRODUCT)); fw.write(String.format("Build.VERSION.SDK_INT: %d\n", Build.VERSION.SDK_INT)); fw.write(String.format("Screen resolution: %d x %d px\n", size.x, size.y)); fw.close(); } catch (IOException e) { e.printStackTrace(); } }