Guest User

Untitled

a guest
Aug 10th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. Intent emailIntent = new Intent(Intent.ACTION_SEND);
  2. // emailIntent.setType("text/plain");
  3. emailIntent.putExtra(Intent.EXTRA_EMAIL, emails);
  4. emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Receipt Voucher from Vawsum");
  5. emailIntent.putExtra(Intent.EXTRA_TEXT, "Please find the receipt voucher attached along with this mail.");
  6. Uri outputFileUri = FileProvider.getUriForFile(this, BuildConfig.APPLICATION_ID + ".fileprovider", new File(String.valueOf(new File(String.valueOf(pdfDir), "VawsumVoucher.pdf"))));// - akash - to send third party apps big size files
  7. emailIntent.putExtra(Intent.EXTRA_STREAM, outputFileUri);
  8. emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  9. emailIntent.setType("application/pdf");
  10.  
  11. startActivity(Intent.createChooser(emailIntent, "Send Email"));
  12.  
  13. <provider
  14. android:name="android.support.v4.content.FileProvider"
  15. android:authorities="com.trakkerz.app.fileprovider"
  16. android:exported="false"
  17. android:grantUriPermissions="true"
  18. tools:replace="android:authorities">
  19. <meta-data
  20. android:name="android.support.FILE_PROVIDER_PATHS"
  21. android:resource="@xml/provider_paths"
  22. tools:replace="android:resource"/>
  23. </provider>
Add Comment
Please, Sign In to add comment