Opening PDF in external reader opens blank file

Hey guys!

I’m new to Kodular and as my first application I’ve been trying to get a button to open a PDF file saved on the device using an external PDF reader.

I added the storage access permission, as well as the document identification. When selecting the desired file, you are asked to select a PDF reader, as normally happens on the device. However, when opening the reader, nothing appears. I’ve already tested with other files, which resulted in the same problem. I also tested opening the files directly on the reader, without using the app, and everything worked correctly. I believe there may be an error with reading the documents or identifying the path, but I don’t have the experience to identify it correctly. Below are the blocks used and the list of components:

  • 1 button
  • 2 Activity Starters
  • 1 Notifier

Thank you in advance for your attention and help!

Which Android version are you using for your tests? Where is the pdf file stored?

To debug this, display the result uri in a label to see, if this makes sense


The minimum SDK Level that I configured in Kodular was Android 5.0 - 5.0.2 (API 21) and the Android version on the device used for testing is 10.

The pdf document is stored on the device, inside the Whatsapp media folder, to be more precise.

The resulting uri is being content://

ok, it is a pdf from the WhatsApp media folder
try to convert the uri into a filename using one of the file extensions to test, if it works using a filename
another test would be to copy the pdf to shared storage and try to open it from there


Thank you for the tips.

I carried out several tests. Instead of reading a pdf file, I changed it to a jpg image to perform the tests. The images are in shared storage, in this case, in the Downloads and DCIM folders.

The reason I switched from pdf to jpg was because I only have one pdf reader installed, while I have 3 image readers.

I also carried out tests for both the image uri and their path after converting the uri.

Result: I have image readers x, y and z. Using the uri as a basis, only reader x opens the images correctly, while readers y and z result in empty images. Using path, only reader z opens the images correctly, while readers x and y display empty images.

I don’t know if the problem could be in the uri/paths, in the image readers or in the version of Android I use (which is 10). Apparently the application works, but there is the problem that it opens only in reader x when using the uri and only in reader z when using the path… The reason for the problem I was having opening PDF documents must be the same, but there was only one reader to perform tests and unfortunately it was the one that cannot open either uri or path.

Any idea what could be happening?

I couldn’t solve the problem, but I tested it on another device that had the Android 9 version and it worked both using the uri and converting it to path. In this case, for testing I opened a .pprt file using WPS Office as a reader. The problem is probably with the reader used for the document, which does not correctly identify the uri/path, or with the version of Android that I was using previously, which was 10. But as the application is already working for my purpose, I did not perform further tests to identify the problem.