List of usage examples for android.content Intent EXTRA_EMAIL
String EXTRA_EMAIL
To view the source code for android.content Intent EXTRA_EMAIL.
Click Source Link
From source file:com.trupti_prajapati.retailapp.view.fragment.SettingsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.frag_aboutus, container, false); getActivity().setTitle("About App"); mToolbar = (Toolbar) rootView.findViewById(R.id.htab_toolbar); if (mToolbar != null) { ((ECartHomeActivity) getActivity()).setSupportActionBar(mToolbar); }//ww w .j a v a2s .com if (mToolbar != null) { ((ECartHomeActivity) getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true); mToolbar.setNavigationIcon(R.drawable.ic_drawer); } mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ((ECartHomeActivity) getActivity()).getmDrawerLayout().openDrawer(GravityCompat.START); } }); mToolbar.setTitleTextColor(Color.WHITE); submitLog = (TextView) rootView.findViewById(R.id.submit_log_txt); if (PreferenceHelper.getPrefernceHelperInstace().getBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, true)) { submitLog.setText("Disable"); } else { submitLog.setText("Enable"); } rootView.findViewById(R.id.submit_log).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (PreferenceHelper.getPrefernceHelperInstace().getBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, true)) { PreferenceHelper.getPrefernceHelperInstace().setBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, false); submitLog.setText("Disable"); } else { PreferenceHelper.getPrefernceHelperInstace().setBoolean(getActivity(), PreferenceHelper.SUBMIT_LOGS, true); submitLog.setText("Enable"); } } }); rootView.setFocusableInTouchMode(true); rootView.requestFocus(); rootView.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK) { Utils.switchContent(R.id.frag_container, Utils.HOME_FRAGMENT, ((ECartHomeActivity) (getContext())), AnimationType.SLIDE_UP); } return true; } }); rootView.findViewById(R.id.picasso).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/square/picasso")); startActivity(browserIntent); } }); rootView.findViewById(R.id.acra).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/ACRA/acra")); startActivity(browserIntent); } }); rootView.findViewById(R.id.pull_zoom_view).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/Frank-Zhu/PullZoomView")); startActivity(browserIntent); } }); rootView.findViewById(R.id.list_buddies).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/jpardogo/ListBuddies")); startActivity(browserIntent); } }); rootView.findViewById(R.id.list_jazzy).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/twotoasters/JazzyListView")); startActivity(browserIntent); } }); rootView.findViewById(R.id.email_dev).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType("text/plain"); emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "serveroverloadofficial@gmail.com" }); emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Hello There"); emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Add Message here"); emailIntent.setType("message/rfc822"); try { startActivity(Intent.createChooser(emailIntent, "Send email using...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(getActivity(), "No email clients installed.", Toast.LENGTH_SHORT).show(); } } }); return rootView; }
From source file:com.geecko.QuickLyric.fragment.SettingsFragment.java
@Override public boolean onPreferenceClick(Preference preference) { AlertDialog.Builder dialog;/*from w ww.ja va 2 s . c o m*/ switch (preference.getKey()) { case "pref_about": dialog = new AlertDialog.Builder(getActivity()); dialog.setView( getActivity().getLayoutInflater().inflate(R.layout.about_dialog, (ViewGroup) getView(), false)); dialog.create().show(); break; case "pref_contribute": Intent browserIntent = new Intent(Intent.ACTION_VIEW); browserIntent.setData(Uri.parse("https://github.com/geecko86/QuickLyric")); if (browserIntent.resolveActivity(getActivity().getPackageManager()) != null) startActivity(browserIntent); break; case "pref_beta": dialog = new AlertDialog.Builder(getActivity()); dialog.setView( getActivity().getLayoutInflater().inflate(R.layout.beta_dialog, (ViewGroup) getView(), false)); dialog.create().show(); break; case "pref_issues": Intent emailIntent = new Intent(Intent.ACTION_SENDTO); emailIntent.setData(Uri.parse("mailto:")); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "quicklyricapp@gmail.com" }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Issues with QuickLyric"); if (emailIntent.resolveActivity(getActivity().getPackageManager()) != null) startActivity(emailIntent); break; } return true; }
From source file:com.reliqartz.firsttipcalc.gui.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { final Intent i; Log.d(TAG, "Menu item selected: " + item.getItemId()); int itemId = item.getItemId(); if (itemId == R.id.action_refresh) { i = getIntent();//from w w w . j av a2 s.co m finish(); startActivity(i); overridePendingTransition(0, 0); return true; } else if (itemId == R.id.action_settings) { i = new Intent(this, SettingsActivity.class); startActivity(i); return true; } else if (itemId == R.id.action_feedback) { i = new Intent(android.content.Intent.ACTION_SEND); i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { "info@reliqartz.com" }); i.putExtra(android.content.Intent.EXTRA_SUBJECT, "Feedback: First Tip App"); i.putExtra(android.content.Intent.EXTRA_TEXT, "Hello, "); i.setType("message/rfc822"); startActivity(i); return true; } else { return super.onOptionsItemSelected(item); } }
From source file:org.chaos.fx.cnbeta.preferences.PreferencesFragment.java
private void composeEmail(String address, String subject) { Intent intent = new Intent(Intent.ACTION_SENDTO); intent.setData(Uri.parse("mailto:")); // only email apps should handle this intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, "\n\n\n\nApp Version" + BuildConfig.VERSION_NAME + "\nAndroid Version: " + Build.VERSION.RELEASE + "\nDevice Model: " + Build.MODEL); if (intent.resolveActivity(getActivity().getPackageManager()) != null) { startActivity(intent);/*from ww w .jav a2 s.c om*/ } }
From source file:com.agateau.equiv.ui.Kernel.java
public void shareCustomProductList(Context context) { File file = context.getFileStreamPath(CUSTOM_PRODUCTS_CSV); Uri contentUri = FileProvider.getUriForFile(context, "com.agateau.equiv.fileprovider", file); final Resources res = context.getResources(); Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("message/rfc822"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { Constants.CUSTOM_PRODUCTS_EMAIL }); intent.putExtra(Intent.EXTRA_SUBJECT, res.getString(R.string.share_email_subject)); intent.putExtra(Intent.EXTRA_STREAM, contentUri); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); context.startActivity(Intent.createChooser(intent, res.getString(R.string.share_via))); }
From source file:ch.luklanis.esscan.history.HistoryActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.history_menu_send_dta_save: case R.id.history_menu_send_dta_other: case R.id.history_menu_send_dta_email: { Message message = Message.obtain(mDataSentHandler, item.getItemId()); createDTAFile(message);/*from www . j a va 2 s . c o m*/ } break; case R.id.history_menu_send_csv: { CharSequence history = mHistoryManager.buildHistory(); Uri historyFile = HistoryManager.saveHistory(history.toString()); String[] recipients = new String[] { PreferenceManager.getDefaultSharedPreferences(this) .getString(PreferencesActivity.KEY_EMAIL_ADDRESS, "") }; if (historyFile == null) { setOkAlert(R.string.msg_unmount_usb); } else { Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:")); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); intent.putExtra(Intent.EXTRA_EMAIL, recipients); String subject = getResources().getString(R.string.history_email_title); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, subject); intent.putExtra(Intent.EXTRA_STREAM, historyFile); intent.setType("text/csv"); startActivity(intent); } } break; case R.id.history_menu_clear: { new CancelOkDialog(R.string.msg_sure).setOkClickListener(new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { mHistoryManager.clearHistory(); dialogInterface.dismiss(); finish(); } }).show(getFragmentManager(), "HistoryActivity.onOptionsItemSelected"); } break; case android.R.id.home: { int error = PsDetailActivity.savePaymentSlip(this); if (error > 0) { setCancelOkAlert(this, error); return true; } NavUtils.navigateUpTo(this, new Intent(this, CaptureActivity.class)); return true; } case R.id.history_menu_copy_code_row: { PsDetailFragment fragment = (PsDetailFragment) getFragmentManager() .findFragmentById(R.id.ps_detail_container); if (fragment != null) { String completeCode = fragment.getHistoryItem().getResult().getCompleteCode(); addCodeRowToClipboard(completeCode); } } break; case R.id.history_menu_send_code_row: { PsDetailFragment fragment = (PsDetailFragment) getFragmentManager() .findFragmentById(R.id.ps_detail_container); if (fragment != null) { IEsrSender sender = getEsrSender(); if (sender != null) { mSendingProgressDialog.show(); fragment.send(PsDetailFragment.SEND_COMPONENT_CODE_ROW, sender, this.historyFragment.getActivatedPosition()); } else { Message message = Message.obtain(mDataSentHandler, R.id.es_send_failed); message.sendToTarget(); } } } break; default: return super.onOptionsItemSelected(item); } return true; }
From source file:com.picogram.awesomeness.SettingsActivity.java
public boolean onPreferenceClick(final Preference preference) { if (preference.getKey().equals("statistics")) { //TODO//from w w w . ja va2 s.c o m Crouton.makeText(this, "This is not yet implemented", Style.INFO).show(); final AlertDialog dialog = new AlertDialog.Builder(this).create(); final String[] scoresTitles = new String[] { "Games Played", "Games Won", "Taps", "Taps per Puzzle", "Tapes per Minute", "Times Played" }; final int gamesPlayed = 0, gamesWon = 0, taps = 0, tapsPerPuzzle = 0, tapsPerMinute = 0, timePlayed = 0; final int[] scores = { gamesPlayed, gamesWon, taps, tapsPerPuzzle, tapsPerMinute, timePlayed }; // TODO: Implement the preferences and what not. final LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); for (int i = 0; i != scores.length; ++i) { final LinearLayout sub = new LinearLayout(this); sub.setLayoutParams(new LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT)); sub.setOrientation(LinearLayout.HORIZONTAL); TextView tv = new TextView(this); tv.setLayoutParams(new TableLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); tv.setText(scoresTitles[i]); sub.addView(tv); tv = new TextView(this); tv.setLayoutParams(new TableLayout.LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT, 1f)); tv.setText(scores[i] + ""); sub.addView(tv); ll.addView(sub); } dialog.setView(ll); dialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(final DialogInterface dialog, final int which) { dialog.dismiss(); } }); dialog.getWindow().getAttributes().windowAnimations = R.style.DialogTheme; dialog.show(); dialog.dismiss(); return true; } else if (preference.getKey().equals("changelog")) { // Launch change log dialog final ChangeLogDialog _ChangelogDialog = new ChangeLogDialog(this); _ChangelogDialog.show(); } else if (preference.getKey().equals("licenses")) { // Launch the licenses stuff. Dialog ld = new LicensesDialog(this, R.raw.licenses, false, false).create(); ld.getWindow().getAttributes().windowAnimations = R.style.DialogTheme; ld.show(); } else if (preference.getKey().equals("email")) { final String email = "warner.73+Picogram@wright.edu"; final String subject = "Picogram - <SUBJECT>"; final String message = "Picogram,\n\n<MESSAGE>"; // Contact me. final Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { email }); emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, message); emailIntent.setType("message/rfc822"); this.startActivity(Intent.createChooser(emailIntent, "Send Mail Using :")); overridePendingTransition(R.anim.fadein, R.anim.exit_left); } else if (preference.getKey().equals("rateapp")) { // TODO fix this when we publish. this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=Picogram"))); overridePendingTransition(R.anim.fadein, R.anim.exit_left); final Editor editor = this.prefs.edit(); editor.putBoolean(RateMeMaybe.PREF.DONT_SHOW_AGAIN, true); editor.commit(); } else if (preference.getKey().equals("logoutgoogle")) { //TODO Crouton.makeText(this, "This is not currently supported.", Style.INFO).show(); } else if (preference.getKey().equals("logoutfacebook")) { //TODO Crouton.makeText(this, "This is not currently supported.", Style.INFO).show(); } else if (preference.getKey().equals("resetusername")) { Util.getPreferences(this).edit().putString("username", "").commit(); Util.getPreferences(this).edit().putBoolean("hasLoggedInUsername", false).commit(); } return false; }
From source file:com.elekso.potfix.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PowerManager pm = (PowerManager) getApplicationContext() .getSystemService(getApplicationContext().POWER_SERVICE); PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, " POTFIX holding wake lock"); wl.acquire();//from w w w . j a v a 2 s.c o m Globals.getInstance().setFlexiblemap(true); // // // new Thread(new Runnable(){ // @Override // public void run() { // try { // LALpotfixservicePortBinding service = new LALpotfixservicePortBinding(); // try { // globaldata_test=service.CheckWS("mandar"); // // } catch (Exception e) { // e.printStackTrace(); // } // } catch (Exception ex) { // ex.printStackTrace(); // } // } // }).start(); String login = ""; // Config.getInstance(getBaseContext(),getCacheDir()).setProfile("df","asd"); login = Config.getInstance(getBaseContext(), getCacheDir()).getProfileName(); if (login == null || login.isEmpty()) { Intent intent = new Intent(this, LoginActivity.class); startActivity(intent); return; } //remove // Stetho.initializeWithDefaults(this); // Toolbar Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); // Drawer drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); tusername = (TextView) drawer.findViewById(R.id.tvusername); // tuseremail =(TextView) findViewById(R.id.tvuseremail); // // if(login!=null) // tusername.setText("jhjhjhjh"); // if(Config.getInstance().getProfileEmail()!=null) //tuseremail.setText(Config.getInstance().getProfileEmail()); // FAB fab = (FloatingActionButton) findViewById(R.id.fab); fab.setRippleColor(Color.parseColor("#78D6F3")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#039FDC"))); fab.setImageResource(R.drawable.ic_gps_fixed_white_24dp); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { switch (currentFragment) { case 1: //profile Snackbar.make(view, "Updating Information", Snackbar.LENGTH_LONG).setAction("Action", null) .show(); Fragment frg = new ProfileFragment(); FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.replace(R.id.frame_containerone, frg); transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); transaction.commit(); break; case 2: //map if (Globals.getInstance().getFlexiblemap()) { Snackbar.make(view, "Free to Scroll", Snackbar.LENGTH_LONG).setAction("Action", null) .show(); Globals.getInstance().setFlexiblemap(false); fab.setRippleColor(Color.parseColor("#FFE082")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#FFB300"))); fab.setImageResource(R.drawable.ic_gps_off_white_24dp); } else { Snackbar.make(view, "Follow Potfix", Snackbar.LENGTH_LONG).setAction("Action", null).show(); Globals.getInstance().setFlexiblemap(true); fab.setRippleColor(Color.parseColor("#78D6F3")); fab.setBackgroundTintList(ColorStateList.valueOf(Color.parseColor("#039FDC"))); fab.setImageResource(R.drawable.ic_gps_fixed_white_24dp); } break; case 3: //share //Snackbar.make(view, "Some sharing action", Snackbar.LENGTH_LONG).setAction("Action", null).show(); String[] TO = { "aziz@potfix.com" }; String[] CC = { "" }; Intent emailIntent = new Intent(Intent.ACTION_SEND); emailIntent.setData(Uri.parse("mailto:")); emailIntent.setType("text/plain"); emailIntent.putExtra(Intent.EXTRA_EMAIL, TO); emailIntent.putExtra(Intent.EXTRA_CC, CC); emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Potfix Communication"); emailIntent.putExtra(Intent.EXTRA_TEXT, "Email message..."); try { startActivity(Intent.createChooser(emailIntent, "Send mail...")); finish(); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(MainActivity.this, "There is no email client installed.", Toast.LENGTH_SHORT) .show(); } break; case 4: //legal Snackbar.make(view, "Software License", Snackbar.LENGTH_LONG).setAction("Action", null).show(); drawer.openDrawer(Gravity.LEFT); break; } } }); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); startService(new Intent(getBaseContext(), BackgroundService.class)); FragmentTransaction mTransaction = getSupportFragmentManager().beginTransaction(); MapsFragment mFRaFragment = new MapsFragment(); mTransaction.add(R.id.frame_containerone, mFRaFragment); mTransaction.commit(); LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) { Toast.makeText(this, "GPS is Enabled in your devide", Toast.LENGTH_SHORT).show(); } else { showGPSDisabledAlertToUser(); } // if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)){ // Toast.makeText(this, "Network is Enabled in your devide", Toast.LENGTH_SHORT).show(); // }else{ // showNetDisabledAlertToUser(); // } createNotification(); }
From source file:com.z.stproperty.PropertyDetailFragment.java
/** * onClick :: OnClickListener//from ww w. jav a 2 s .c o m * * Is common on-click listener for all the buttons and images in home screen * This is grouped into single listener to make easier to alter the code and reduce the * line of code. * * This will check the View ID to match with the predefined View-ID to identify * which view is clicked * * Based on the view id this will perform different functionalities */ private void performClickAction(View v) { try { switch (v.getId()) { case R.id.LoanCalculator: Intent calIntent = new Intent(getActivity(), LoanCalculator.class); calIntent.putExtra("price", price); startActivity(calIntent); break; case R.id.AgentMobile: String url = "tel:" + mobileNoStr; url = url.replace("+65-", ""); Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse(url)); startActivity(callIntent); break; case R.id.SendEmailBtn: String text = "I'm interested in your property advertised on STProperty\n\n" + "PROPERTY TITLE:" + title + "\n" + "PRICE:" + price + "\n\nClick on the following link to view more details about the property\n\n" + prurl; Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("plain/text"); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { agentEmail }); intent.putExtra(Intent.EXTRA_SUBJECT, "Enquiry"); intent.putExtra(Intent.EXTRA_TEXT, text); SharedFunction.postAnalytics(PropertyDetailFragment.this.getActivity(), "Lead", "Successful Email Enquiry", title); startActivity(Intent.createChooser(intent, "")); break; /**case R.id.SendEnquiryBtn: Intent enqInt = new Intent(getActivity(), SaleEnquiry.class); enqInt.putExtra("propertyId", detailsJson.getString("id")); enqInt.putExtra("agentId", detailsJson.getJSONObject("seller_info").getString("agent_cea_reg_no")); startActivity(enqInt); break;*/ default: break; } } catch (Exception e) { Log.e(this.getClass().getSimpleName(), e.getLocalizedMessage(), e); } }
From source file:org.tomahawk.tomahawk_android.utils.TomahawkExceptionReporter.java
/** * Pull information from the given {@link CrashReportData} and send it via HTTP to * oops.tomahawk-player.org or sends it as a TEXT intent, if IS_SILENT is true *///from w w w. j a v a 2 s .c om @Override public void send(CrashReportData data) throws ReportSenderException { StringBuilder body = new StringBuilder(); List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2); nameValuePairs.add(new BasicNameValuePair("Version", data.getProperty(ReportField.APP_VERSION_NAME))); nameValuePairs.add(new BasicNameValuePair("BuildID", data.getProperty(ReportField.BUILD))); nameValuePairs.add(new BasicNameValuePair("ProductName", "tomahawk-android")); nameValuePairs.add(new BasicNameValuePair("Vendor", "Tomahawk")); nameValuePairs.add(new BasicNameValuePair("timestamp", data.getProperty(ReportField.USER_CRASH_DATE))); for (NameValuePair pair : nameValuePairs) { body.append("--thkboundary\r\n"); body.append("Content-Disposition: form-data; name=\""); body.append(pair.getName()).append("\"\r\n\r\n").append(pair.getValue()).append("\r\n"); } body.append("--thkboundary\r\n"); body.append("Content-Disposition: form-data; name=\"upload_file_minidump\"; filename=\"") .append(data.getProperty(ReportField.REPORT_ID)).append("\"\r\n"); body.append("Content-Type: application/octet-stream\r\n\r\n"); body.append("============== Tomahawk Exception Report ==============\r\n\r\n"); body.append("Report ID: ").append(data.getProperty(ReportField.REPORT_ID)).append("\r\n"); body.append("App Start Date: ").append(data.getProperty(ReportField.USER_APP_START_DATE)).append("\r\n"); body.append("Crash Date: ").append(data.getProperty(ReportField.USER_CRASH_DATE)).append("\r\n\r\n"); body.append("--------- Phone Details ----------\r\n"); body.append("Phone Model: ").append(data.getProperty(ReportField.PHONE_MODEL)).append("\r\n"); body.append("Brand: ").append(data.getProperty(ReportField.BRAND)).append("\r\n"); body.append("Product: ").append(data.getProperty(ReportField.PRODUCT)).append("\r\n"); body.append("Display: ").append(data.getProperty(ReportField.DISPLAY)).append("\r\n"); body.append("-----------------------------------\r\n\r\n"); body.append("----------- Stack Trace -----------\r\n"); body.append(data.getProperty(ReportField.STACK_TRACE)).append("\r\n"); body.append("-----------------------------------\r\n\r\n"); body.append("------- Operating System ---------\r\n"); body.append("App Version Name: ").append(data.getProperty(ReportField.APP_VERSION_NAME)).append("\r\n"); body.append("Total Mem Size: ").append(data.getProperty(ReportField.TOTAL_MEM_SIZE)).append("\r\n"); body.append("Available Mem Size: ").append(data.getProperty(ReportField.AVAILABLE_MEM_SIZE)).append("\r\n"); body.append("Dumpsys Meminfo: ").append(data.getProperty(ReportField.DUMPSYS_MEMINFO)).append("\r\n"); body.append("-----------------------------------\r\n\r\n"); body.append("-------------- Misc ---------------\r\n"); body.append("Package Name: ").append(data.getProperty(ReportField.PACKAGE_NAME)).append("\r\n"); body.append("File Path: ").append(data.getProperty(ReportField.FILE_PATH)).append("\r\n"); body.append("Android Version: ").append(data.getProperty(ReportField.ANDROID_VERSION)).append("\r\n"); body.append("Build: ").append(data.getProperty(ReportField.BUILD)).append("\r\n"); body.append("Initial Configuration: ").append(data.getProperty(ReportField.INITIAL_CONFIGURATION)) .append("\r\n"); body.append("Crash Configuration: ").append(data.getProperty(ReportField.CRASH_CONFIGURATION)) .append("\r\n"); body.append("Settings Secure: ").append(data.getProperty(ReportField.SETTINGS_SECURE)).append("\r\n"); body.append("User Email: ").append(data.getProperty(ReportField.USER_EMAIL)).append("\r\n"); body.append("User Comment: ").append(data.getProperty(ReportField.USER_COMMENT)).append("\r\n"); body.append("-----------------------------------\r\n\r\n"); body.append("---------------- Logs -------------\r\n"); body.append("Logcat: ").append(data.getProperty(ReportField.LOGCAT)).append("\r\n\r\n"); body.append("Events Log: ").append(data.getProperty(ReportField.EVENTSLOG)).append("\r\n\r\n"); body.append("Radio Log: ").append(data.getProperty(ReportField.RADIOLOG)).append("\r\n"); body.append("-----------------------------------\r\n\r\n"); body.append("=======================================================\r\n\r\n"); body.append("--thkboundary\r\n"); body.append( "Content-Disposition: form-data; name=\"upload_file_tomahawklog\"; filename=\"Tomahawk.log\"\r\n"); body.append("Content-Type: text/plain\r\n\r\n"); body.append(data.getProperty(ReportField.LOGCAT)); body.append("\r\n--thkboundary--\r\n"); if ("true".equals(data.getProperty(ReportField.IS_SILENT))) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); body.insert(0, "Please tell us why you're sending us this log:\n\n\n\n\n"); intent.putExtra(Intent.EXTRA_TEXT, body.toString()); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { "support@tomahawk-player.org" }); intent.putExtra(Intent.EXTRA_SUBJECT, "Tomahawk Android Log"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); TomahawkApp.getContext().startActivity(intent); } else { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://oops.tomahawk-player.org/addreport.php"); httppost.setHeader("Content-type", "multipart/form-data; boundary=thkboundary"); try { httppost.setEntity(new StringEntity(body.toString())); httpclient.execute(httppost); } catch (ClientProtocolException e) { Log.e(TAG, "send: " + e.getClass() + ": " + e.getLocalizedMessage()); } catch (IOException e) { Log.e(TAG, "send: " + e.getClass() + ": " + e.getLocalizedMessage()); } } }