List of usage examples for android.os Build ID
String ID
To view the source code for android.os Build ID.
Click Source Link
From source file:com.nbplus.push.PushService.java
private void getFromServer(final String url) { if (mRequestBody == null) { String prefName = mContext.getApplicationContext().getPackageName() + "_preferences"; SharedPreferences prefs = mContext.getSharedPreferences(prefName, Context.MODE_PRIVATE); // load from preferences.. String deviceId = prefs.getString(PushConstants.KEY_DEVICE_ID, ""); if (StringUtils.isEmptyString(deviceId)) { deviceId = DeviceUtils.getDeviceIdByMacAddress(mContext); prefs.edit().putString(PushConstants.KEY_DEVICE_ID, deviceId).apply(); }//from www . j a va 2s. com GetPushInterfaceRequestBody reqBodyObj = new GetPushInterfaceRequestBody(); reqBodyObj.deviceId = deviceId; reqBodyObj.os = Build.VERSION.RELEASE; reqBodyObj.pushVersion = Integer.toString(BuildConfig.VERSION_CODE); reqBodyObj.vendor = Build.MANUFACTURER; reqBodyObj.model = DeviceUtils.getDeviceName(); reqBodyObj.os = Build.ID + " " + Build.VERSION.RELEASE; reqBodyObj.deviceType = "android"; Gson gson = new GsonBuilder().create(); mRequestBody = gson.toJson(reqBodyObj, new TypeToken<GetPushInterfaceRequestBody>() { }.getType()); } // RequestQueue requestQueue = Volley.newRequestQueue(mContext, new HurlStack() { // @Override // protected HttpURLConnection createConnection(URL url) throws IOException { // HttpURLConnection connection = super.createConnection(url); // // Fix for bug in Android runtime(!!!): // // https://code.google.com/p/android/issues/detail?id=24672 // connection.setRequestProperty("Accept-Encoding", ""); // // return connection; // } // }); final GsonRequest gsonRequest = new GsonRequest(Request.Method.POST, url, mRequestBody, PushInterfaceData.class, new Response.Listener<PushInterfaceData>() { @Override public void onResponse(PushInterfaceData response) { Log.d(TAG, ">>> get PushInterfaceData success !!!"); mApiRetryCount = 0; Message message = new Message(); message.what = PushConstants.HANDLER_MESSAGE_GET_PUSH_GATEWAY_DATA; message.obj = response; mHandler.sendMessage(message); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { /** * 2015.10.05 * 1? ? ?? . */ Log.d(TAG, ">>> get PushInterfaceData error... retry connection after 1 minutes..."); if (mPushRunnable.getState() != PushRunnable.State.Stopped) { mPushRunnable.releasePushClientSocket(false); } mHandler.removeMessages(PushConstants.HANDLER_MESSAGE_RETRY_MESSAGE); mHandler.sendEmptyMessageDelayed(PushConstants.HANDLER_MESSAGE_RETRY_MESSAGE, PushService.MILLISECONDS * PushService.mNextRetryPeriodTerm); } }); if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(mContext, new HurlStack() { @Override protected HttpURLConnection createConnection(URL url) throws IOException { HttpURLConnection connection = super.createConnection(url); // Fix for bug in Android runtime(!!!): // https://code.google.com/p/android/issues/detail?id=24672 connection.setRequestProperty("Accept-Encoding", ""); return connection; } }); } gsonRequest.setRetryPolicy(new DefaultRetryPolicy(20 * 1000, 3, 1.0f)); mRequestQueue.add(gsonRequest); }
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 ww w.ja va2 s . c o m*/ 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; }
From source file:org.brandroid.openmanager.fragments.DialogHandler.java
public static String getDeviceInfo() { String ret = ""; String sep = "\n"; ret += sep + "Build Info:" + sep; ret += "SDK: " + Build.VERSION.SDK_INT + sep; if (OpenExplorer.SCREEN_WIDTH > -1) ret += "Screen: " + OpenExplorer.SCREEN_WIDTH + "x" + OpenExplorer.SCREEN_HEIGHT + sep; if (OpenExplorer.SCREEN_DPI > -1) ret += "DPI: " + OpenExplorer.SCREEN_DPI + sep; ret += "Lang: " + getLangCode() + sep; ret += "Fingerprint: " + Build.FINGERPRINT + sep; ret += "Manufacturer: " + Build.MANUFACTURER + sep; ret += "Model: " + Build.MODEL + sep; ret += "Product: " + Build.PRODUCT + sep; ret += "Brand: " + Build.BRAND + sep; ret += "Board: " + Build.BOARD + sep; ret += "Bootloader: " + Build.BOOTLOADER + sep; ret += "Hardware: " + Build.HARDWARE + sep; ret += "Display: " + Build.DISPLAY + sep; ret += "Language: " + Locale.getDefault().getDisplayLanguage() + sep; ret += "Country: " + Locale.getDefault().getDisplayCountry() + sep; ret += "Tags: " + Build.TAGS + sep; ret += "Type: " + Build.TYPE + sep; ret += "User: " + Build.USER + sep; if (Build.UNKNOWN != null) ret += "Unknown: " + Build.UNKNOWN + sep; ret += "ID: " + Build.ID; return ret;/*from w w w .j a v a 2 s. co m*/ }
From source file:android_network.hetnet.vpn_service.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override//from ww w . jav a 2 s . co m protected Intent doInBackground(Object... objects) { StringBuilder sb = new StringBuilder(); sb.append(context.getString(R.string.msg_issue)); sb.append("\r\n\r\n\r\n\r\n"); // Get version info String version = getSelfVersionName(context); sb.append(String.format("NetGuard: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); // Get device info sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context))); sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); sb.append(getSubscriptionInfo(context)); sb.append("\r\n\r\n"); // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+netguard@faircode.eu" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.execute(); }
From source file:eu.faircode.netguard.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override/*from w w w . ja v a 2s .c o m*/ protected Intent doInBackground(Object... objects) { StringBuilder sb = new StringBuilder(); sb.append(context.getString(R.string.msg_issue)); sb.append("\r\n\r\n\r\n\r\n"); // Get version info String version = getSelfVersionName(context); sb.append(String.format("NetGuard: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); // Get device info sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); // Get DNS sb.append("DNS system:\r\n"); for (String dns : getDefaultDNS(context)) sb.append("- ").append(dns).append("\r\n"); sb.append("DNS VPN:\r\n"); for (InetAddress dns : ServiceSinkhole.getDns(context)) sb.append("- ").append(dns).append("\r\n"); sb.append("\r\n"); // Get TCP connection info String line; BufferedReader in; try { sb.append("/proc/net/tcp:\r\n"); in = new BufferedReader(new FileReader("/proc/net/tcp")); while ((line = in.readLine()) != null) sb.append(line).append("\r\n"); in.close(); sb.append("\r\n"); sb.append("/proc/net/tcp6:\r\n"); in = new BufferedReader(new FileReader("/proc/net/tcp6")); while ((line = in.readLine()) != null) sb.append(line).append("\r\n"); in.close(); sb.append("\r\n"); } catch (IOException ex) { sb.append(ex.toString()).append("\r\n"); } // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+netguard@faircode.eu" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:eu.faircode.adblocker.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override/* w ww .j a v a2s .c o m*/ protected Intent doInBackground(Object... objects) { // Get device info StringBuilder sb = new StringBuilder(); String version = getSelfVersionName(context); sb.append(String.format("adblocker: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context))); sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); sb.append(getSubscriptionInfo(context)); sb.append("\r\n\r\n"); // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Finalize message sb.append("Please describe your problem:\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "marcel+adblocker@faircode.eu" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "NetGuard " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.execute(); }
From source file:com.droid.app.fotobot.FotoBot.java
/** * ? ? ? /*from w w w. ja v a 2 s .c o m*/ * * @param h * @param str */ public void SendMail(Handler h, String str, String fc_str, String bc_video, String fc_video) { // final FotoBot fb = (FotoBot) getApplicationContext(); Mail m = new Mail(getApplicationContext(), EMail_Sender, EMail_Sender_Password, SMTP_Host, SMTP_Port); String[] toArr = { EMail_Recepient }; String s = "Debug-infos:"; s += "\n OS Version: " + System.getProperty("os.version") + "(" + android.os.Build.VERSION.INCREMENTAL + ")"; s += "\n OS API Level: " + android.os.Build.VERSION.SDK_INT; s += "\n Device: " + android.os.Build.DEVICE; s += "\n Model (and Product): " + android.os.Build.MODEL + " (" + android.os.Build.PRODUCT + ")"; s += "\n RELEASE: " + android.os.Build.VERSION.RELEASE; s += "\n BRAND: " + android.os.Build.BRAND; s += "\n DISPLAY: " + android.os.Build.DISPLAY; s += "\n CPU_ABI: " + android.os.Build.CPU_ABI; s += "\n CPU_ABI2: " + android.os.Build.CPU_ABI2; s += "\n UNKNOWN: " + android.os.Build.UNKNOWN; s += "\n HARDWARE: " + android.os.Build.HARDWARE; s += "\n Build ID: " + android.os.Build.ID; s += "\n MANUFACTURER: " + android.os.Build.MANUFACTURER; s += "\n SERIAL: " + android.os.Build.SERIAL; s += "\n USER: " + android.os.Build.USER; s += "\n HOST: " + android.os.Build.HOST; m.setTo(toArr); m.setFrom(EMail_Sender); m.setSubject("Fotobot v" + versionName + " " + Camera_Name); String email_body = ""; email_body = "Fotobot v" + versionName + "\n" + "---------------------------------------------\n" + "Camera Name" + ": " + Camera_Name + "\n" + getResources().getString(R.string.battery_charge) + ": " + battery_level + "%" + "\n" + getResources().getString(R.string.battery_temperature) + ": " + battery_temperature + "C" + "\n"; if (Attached_Info_Detailisation.equals("Normal") || Attached_Info_Detailisation.equals("Detailed")) { email_body = email_body + getResources().getString(R.string.gsm) + ": " + GSM_Signal + "ASU " + (2.0 * GSM_Signal - 113) + "dBm" + "\n" + "-50 -82 dbm - very good" + "\n" + "-83 -86 dbm - good" + "\n" + "-87 -91 dbm - normal" + "\n" + "-92 -95 dbm - bad" + "\n" + "-96 -100 dbm - almost no signal" + "\n" + "---------------------------------------------\n" + "Image Index:" + Image_Index + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.phone_memory) + ":" + "\n" + "totalMemory: " + totalMemory + "\n" + "usedMemory: " + usedMemory + "\n" + "freeMemory: " + freeMemory + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.email_sending_time) + ": " + email_sending_time + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.Fotobot_settings) + ":\n" + "Network_Channel: " + Network_Channel + "\n" + "Network_Connection_Method: " + Network_Connection_Method + "\n" + "Use_Flash: " + Use_Flash + "\n" + "JPEG_Compression: " + JPEG_Compression + "\n" + "Photo_Frequency: " + Photo_Frequency + "\n" + "process_delay: " + process_delay + "\n" + "Image_Scale: " + Image_Scale + "\n" + "Image_Size: " + Image_Size + "\n" + "EMail_Sender: " + EMail_Sender + "\n" + "EMail_Sender_Password: *********" + "\n" + "EMail_Recepient: " + EMail_Recepient + "\n" + "Log_Font_Size: " + Log_Font_Size + "\n" + "Config_Font_Size: " + Config_Font_Size + "\n" + "Photo_Post_Processing_Method: " + Photo_Post_Processing_Method + "\n" + "SMTP_Host: " + SMTP_Host + "\n" + "SMTP_Port: " + SMTP_Port + "\n" + "Log length: " + loglength + "\n" + "FLog length: " + floglength + "\n" + "wake_up_interval: " + wake_up_interval + "\n" + "---------------------------------------------\n" + getResources().getString(R.string.hardware_info) + ":\n" + "Android: " + Build.VERSION.SDK_INT + "\n" + s + "\n" + "---------------------------------------------\n" + "Available SMS commands: " + "\n" + sms_commands_list() + "\n"; ; if (Attached_Info_Detailisation.equals("Detailed")) { email_body = email_body + "\n\n\nActive tasks:\n" + Top + "\n\n\nBack Camera Properties:\n" + Camera_Properties + "\n\n\nFront Camera Properties:\n" + fc_Camera_Properties; } } m.setBody(email_body); File attach_file; if (make_photo_bc && bc_image_attach) { attach_file = new File(str); boolean fileExists = attach_file.isFile(); if (fileExists) { } else { SendMessage("ERROR: image doesn't exist for attaching to email.", MSG_FAIL); } } if (make_video_bc && bc_video_attach) { attach_file = new File(bc_video); boolean fileExists = attach_file.isFile(); if (fileExists) { } else { SendMessage("ERROR: video " + bc_video + " doesn't exist for attaching to email.", MSG_FAIL); } } if (front_camera && make_photo_fc && fc_image_attach) { attach_file = new File(fc_str); boolean fc_fileExists = attach_file.isFile(); if (front_camera && fc_fileExists && make_photo_fc) { } else { SendMessage("ERROR: front camera image doesn't exist for attaching to email.", MSG_FAIL); } } if (front_camera && make_video_fc && fc_video_attach) { attach_file = new File(fc_video); boolean fc_fileExists = attach_file.isFile(); if (front_camera && fc_fileExists && make_photo_fc) { } else { SendMessage("ERROR: video " + fc_video + " doesn't exist for attaching to email.", MSG_FAIL); } } if (attach_log) { attach_file = new File((work_dir + "/logfile.txt")); boolean fileExists = attach_file.isFile(); if (fileExists) { } else { SendMessage("ERROR: log doesn't exist for attaching to email.", MSG_FAIL); } } try { if (make_photo_bc && bc_image_attach) { m.addAttachment(str); } if (front_camera && make_photo_fc && fc_image_attach) { m.addAttachment(fc_str); } if (make_video_bc && bc_image_attach) { m.addAttachment(bc_video); } if (front_camera && make_video_fc && fc_image_attach) { m.addAttachment(fc_video); } if (attach_log) { m.addAttachment(work_dir + "/logfile.txt"); } fbpause(h, process_delay); if (m.send()) { SendMessage(getResources().getString(R.string.foto_sent), MSG_PASS); SaveSettings(); } else { SendMessage("ERROR: ? ", MSG_FAIL); } } catch (Exception e) { SendMessage("Could not send email", MSG_FAIL); Log.e("MailApp", "Could not send email", e); } }
From source file:com.master.metehan.filtereagle.Util.java
public static void sendLogcat(final Uri uri, final Context context) { AsyncTask task = new AsyncTask<Object, Object, Intent>() { @Override//from w w w . j ava2 s. c om protected Intent doInBackground(Object... objects) { StringBuilder sb = new StringBuilder(); sb.append(context.getString(R.string.msg_issue)); sb.append("\r\n\r\n\r\n\r\n"); // Get version info String version = getSelfVersionName(context); sb.append(String.format("FilterEagle: %s/%d\r\n", version, getSelfVersionCode(context))); sb.append(String.format("Android: %s (SDK %d)\r\n", Build.VERSION.RELEASE, Build.VERSION.SDK_INT)); sb.append("\r\n"); // Get device info sb.append(String.format("Brand: %s\r\n", Build.BRAND)); sb.append(String.format("Manufacturer: %s\r\n", Build.MANUFACTURER)); sb.append(String.format("Model: %s\r\n", Build.MODEL)); sb.append(String.format("Product: %s\r\n", Build.PRODUCT)); sb.append(String.format("Device: %s\r\n", Build.DEVICE)); sb.append(String.format("Host: %s\r\n", Build.HOST)); sb.append(String.format("Display: %s\r\n", Build.DISPLAY)); sb.append(String.format("Id: %s\r\n", Build.ID)); sb.append(String.format("Fingerprint: %B\r\n", hasValidFingerprint(context))); String abi; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) abi = Build.CPU_ABI; else abi = (Build.SUPPORTED_ABIS.length > 0 ? Build.SUPPORTED_ABIS[0] : "?"); sb.append(String.format("ABI: %s\r\n", abi)); sb.append("\r\n"); sb.append(String.format("VPN dialogs: %B\r\n", isPackageInstalled("com.android.vpndialogs", context))); try { sb.append(String.format("Prepared: %B\r\n", VpnService.prepare(context) == null)); } catch (Throwable ex) { sb.append("Prepared: ").append((ex.toString())).append("\r\n") .append(Log.getStackTraceString(ex)); } sb.append(String.format("Permission: %B\r\n", hasPhoneStatePermission(context))); sb.append("\r\n"); sb.append(getGeneralInfo(context)); sb.append("\r\n\r\n"); sb.append(getNetworkInfo(context)); sb.append("\r\n\r\n"); sb.append(getSubscriptionInfo(context)); sb.append("\r\n\r\n"); // Get settings SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Map<String, ?> all = prefs.getAll(); for (String key : all.keySet()) sb.append("Setting: ").append(key).append('=').append(all.get(key)).append("\r\n"); sb.append("\r\n"); // Write logcat OutputStream out = null; try { Log.i(TAG, "Writing logcat URI=" + uri); out = context.getContentResolver().openOutputStream(uri); out.write(getLogcat().toString().getBytes()); out.write(getTrafficLog(context).toString().getBytes()); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); sb.append(ex.toString()).append("\r\n").append(Log.getStackTraceString(ex)).append("\r\n"); } finally { if (out != null) try { out.close(); } catch (IOException ignored) { } } // Build intent Intent sendEmail = new Intent(Intent.ACTION_SEND); sendEmail.setType("message/rfc822"); sendEmail.putExtra(Intent.EXTRA_EMAIL, new String[] { "metehan.ozsoy@gmail.com" }); sendEmail.putExtra(Intent.EXTRA_SUBJECT, "FilterEagle " + version + " logcat"); sendEmail.putExtra(Intent.EXTRA_TEXT, sb.toString()); sendEmail.putExtra(Intent.EXTRA_STREAM, uri); return sendEmail; } @Override protected void onPostExecute(Intent sendEmail) { if (sendEmail != null) try { context.startActivity(sendEmail); } catch (Throwable ex) { Log.e(TAG, ex.toString() + "\n" + Log.getStackTraceString(ex)); } } }; task.execute(); }
From source file:biz.bokhorst.xprivacy.ActivityMain.java
@SuppressLint("DefaultLocale") private void optionAbout() { // About/*from w w w .ja v a2 s .com*/ Dialog dlgAbout = new Dialog(this); dlgAbout.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgAbout.setTitle(R.string.menu_about); dlgAbout.setContentView(R.layout.about); dlgAbout.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); // Show version try { int userId = Util.getUserId(Process.myUid()); Version currentVersion = new Version(Util.getSelfVersionName(this)); Version storedVersion = new Version( PrivacyManager.getSetting(userId, PrivacyManager.cSettingVersion, "0.0")); boolean migrated = PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingMigrated, false); String versionName = currentVersion.toString(); if (currentVersion.compareTo(storedVersion) != 0) versionName += "/" + storedVersion.toString(); if (!migrated) versionName += "!"; int versionCode = Util.getSelfVersionCode(this); TextView tvVersion = (TextView) dlgAbout.findViewById(R.id.tvVersion); tvVersion.setText(String.format(getString(R.string.app_version), versionName, versionCode)); } catch (Throwable ex) { Util.bug(null, ex); } if (!PrivacyManager.cVersion3 || Hook.isAOSP(19)) ((TextView) dlgAbout.findViewById(R.id.tvCompatibility)).setVisibility(View.GONE); // Show license String licensed = Util.hasProLicense(this); TextView tvLicensed1 = (TextView) dlgAbout.findViewById(R.id.tvLicensed); TextView tvLicensed2 = (TextView) dlgAbout.findViewById(R.id.tvLicensedAlt); if (licensed == null) { tvLicensed1.setText(Environment.getExternalStorageDirectory().getAbsolutePath()); tvLicensed2.setText(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getAbsolutePath()); } else { tvLicensed1.setText(String.format(getString(R.string.app_licensed), licensed)); tvLicensed2.setVisibility(View.GONE); } // Show some build properties String android = String.format("%s (%d)", Build.VERSION.RELEASE, Build.VERSION.SDK_INT); ((TextView) dlgAbout.findViewById(R.id.tvAndroid)).setText(android); ((TextView) dlgAbout.findViewById(R.id.build_brand)).setText(Build.BRAND); ((TextView) dlgAbout.findViewById(R.id.build_manufacturer)).setText(Build.MANUFACTURER); ((TextView) dlgAbout.findViewById(R.id.build_model)).setText(Build.MODEL); ((TextView) dlgAbout.findViewById(R.id.build_product)).setText(Build.PRODUCT); ((TextView) dlgAbout.findViewById(R.id.build_device)).setText(Build.DEVICE); ((TextView) dlgAbout.findViewById(R.id.build_host)).setText(Build.HOST); ((TextView) dlgAbout.findViewById(R.id.build_display)).setText(Build.DISPLAY); ((TextView) dlgAbout.findViewById(R.id.build_id)).setText(Build.ID); dlgAbout.setCancelable(true); final int userId = Util.getUserId(Process.myUid()); if (PrivacyManager.getSettingBool(userId, PrivacyManager.cSettingFirstRun, true)) dlgAbout.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Dialog dlgUsage = new Dialog(ActivityMain.this); dlgUsage.requestWindowFeature(Window.FEATURE_LEFT_ICON); dlgUsage.setTitle(R.string.app_name); dlgUsage.setContentView(R.layout.usage); dlgUsage.setFeatureDrawableResource(Window.FEATURE_LEFT_ICON, getThemed(R.attr.icon_launcher)); dlgUsage.setCancelable(true); dlgUsage.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { PrivacyManager.setSetting(userId, PrivacyManager.cSettingFirstRun, Boolean.FALSE.toString()); optionLegend(); } }); dlgUsage.show(); } }); dlgAbout.show(); }