I have a problem ... When I try to open Gmail via Intent to attach a file, it appears the part of writing a new email, but it does not attach my file. The PDF is inside a folder of the app itself with this path.:(/storage/emulated/0/Android/data/teste.com.br.cartaovisitateste/files/business.pdf), however it does not take the PDF there inside to attach to email Someone out there knows what it can be? My Gmail Intent code:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("vnd.android.cursor.dir/email");
i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
i.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
i.putExtra(Intent.EXTRA_EMAIL, "");
// funciona parcialmente, mas ele diz que encontrou um arquivo vazio
i.putExtra(Intent.EXTRA_STREAM, Uri.parse("/storage/emulated/0/Android/data/teste.com.br.cartaovisitateste/files/business.pdf"));
// it does not work too
Uri.fromFile(new File(Environment.getDataDirectory().getAbsolutePath(), "business.pdf"));
i.putExtra(Intent.EXTRA_SUBJECT, String.valueOf(Hawk.get("registro_nome")).concat(" Business Card"));
startActivity(Intent.createChooser(i, "Enviando e-mail..."));