Activity Starter pdf open failed

I'm going to open the pdf file stored locally in the app inventer using the activity starter.
It works fine in Android version 8, but in Android 11, "You cannot access this file. Please check the connection or make the file name short" and the file will not open.
What's the problem, masters, help!
20220517_161950

i am facing same issue to open PDFs in Android 11. I have downloaded the file in ASD itself, but the error comes "No such activity found". So I tried 'View PDF' extension, it does opened small pdf file (150 kb) but when tried opening big pdf files (2.5 mb, 300 pages) the app got hanged. so I am trying again to troubleshoot Activity starter errors. Pls help.


Could you share the pdf (2.5mb 300pages) fopr testing?

here it is. Thanks in advance.
GRhindi.pdf (2.6 MB)

Thanks, confirms what you says, crashed on Android 10 and 12, just due to either size or number of pages (the latter more likely).

I will have a think about how to handle large multipage pdfs.

Quick update. viewPDF can render @ 100 pages of your pdf before it crashes, so I guess it is safer to set a limit of @ 50 pages, before requesting the next 50, and so on.

Need to find a way to automate this, so might be a few days.....

1 Like

Found some time and motivation, try this:

testLargePDFV1.aia (2.4 MB)

There is some additional code in the extension that checks for number of pages, and generates a list of page ranges (I provided a label to show these). Additionally a startPage and an endPage variable is added to the main ViewPDF block.

Then the first range is shown, and a Next button appears. Clicking this will generate the next range of pages, and so on.

For PDF < 50 pages you can use startPage = 0 and endPage = -1 to show the entire PDF.

A bit of a mix and match between extension code and blocks, but it seems to work OK.

Now published here

1 Like

Thanks a lot for your valuable time. My app has more than 50 pdf of such types, and i was using activity starter to open those, which still works in older andorid versions. i think i will mess up adding new blocks for rendering pages so i was looking for easy way out.

Though I tried the aia, it is showing no such directory in android 11 and android 8 phones.

1 Like

Try this one:
testLargePDFV2.aia (2.4 MB)

1 Like

still getting the error " no such directory or file". I checked the asd folder, inside files folder there is no file or folder, i guess this might be the reason.

Companion or APK?

No, if take a look at my blocks than you will see that the pdf file is accessed from the assets (Companion). So it will only work with Companion.

Try this one (copied to pdf from assets to ASD):
testLargePDFV3.aia (2.4 MB)

This should also work with the compiled app (APK).

1 Like

it worked, thanks a lot. have to figure out for previous button to load back previous pages.
any chances on activity starter?