I am new to android programming. I already implemented that my app generates a pdf document, and it creates everything well. The problem, I want to send a Snackbar with the action to open it in another app (pdf reader) all right up there, the question is that when you open it, it comes out so I can put a password ??? How to solve this problem, clarify that only comes out of the password when I send it open from my app, that is, if I try to open it from the file browser, it opens up well. This is the method with which I try to open the pdf
private void notificacionPDFCreado(final String nombPDF) {
Snackbar.make(linearLayout_totales, "PDF Creado Satisfactoriamente", Snackbar.LENGTH_INDEFINITE)
.setActionTextColor(Color.parseColor("#ffff7663"))
.setAction("Ver", new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i("Snackbar", "Pulsada acción snackbar!");
File file = new File(Environment.getExternalStorageDirectory() + "/" + Environment.DIRECTORY_DOCUMENTS,nombPDF);
Uri path = Uri.fromFile(file);
Log.i("Snackbar", "" + path);
Intent pdfOpenintent = new Intent(Intent.ACTION_VIEW);
pdfOpenintent.setDataAndType(path, "application/pdf");
pdfOpenintent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//Intent intent = Intent.createChooser(pdfOpenintent,"Abrir con...");
try {
startActivity(pdfOpenintent);
Toast.makeText(DeudasCobrar.this, "Abriendo PDF " + nombPDF, Toast.LENGTH_SHORT).show();
} catch (ActivityNotFoundException e) {
Log.i("Snackbar", "Error al iniciar activity");
}
}
})
.show();
}