How to read a PDF file using another application from internal memory?

In my application, I create a pdf file in the internal application files (data / data / package / files). I want these files to be readable when I read them with this code:

 Uri path = Uri.fromFile(pdfFile); 
 Intent pdfIntent = new Intent(Intent.ACTION_VIEW);
 pdfIntent.setDataAndType(path, "application/pdf");
 pdfIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

I read about using the openOutputStream () method, but I have no hint how to read them through this. Can anyone help me?

EDIT

pdfFile -

    File    directory=getFilesDir();
    pdfFile=new File(directory,filename+".pdf"); 
+3
source share
2 answers

Transfer MODE_WORLD_READABLEto openOutputStream()when writing PDF to internal memory. Theoretically, this will allow third-party applications to read it.

ContentProvider , , , (, PDF assets/ ).

+1

:
pdfFile.setReadable(true, false);

0

All Articles