How to read a pdf file from ASD with Activity Starter?

error showing
error block

Remove / before manish.pdf

You have to fix this path:

image

please share your aia file

Try this:

PdfCreator.aia (19.9 KB)

1 Like

it’s work but first pdf download then open.

showing my blocks

That’s because you’re downloading to this path:
image
And then reading the file from a different one.

You are downloading to:
ASD/Downloads/ms/manish.pdf

And trying to read from:
ASD/manish.pdf

You might want to read again here

that the ASD is only accessible by your own app, but not for other apps like pdf readers

Taifun

It is possible with help of activity starter.

Apk is there to test.

@Lollipop Read the complete thread to find out, that another app (which has been started by the activity starter) can’t access the ASD of your app… i e. it is not working

And why do we have to discuss this again in another thread?
Taifun

Why are you asking him to read ? Did he say anything wrong?

I’m asking you to read. . I now edited my post to clarify that…
Taifun

I don’t know what you are saying.

This is the discussion topic.

How to read a pdf file from ASD with Activity Starter?
According to me, it is possible to do so. Other user ‘fransico’ has also suggested the same.
After that you replied to him saying

I want to know why are you asking him to read? Did he say anything wrong?

I’m not saying that other app(pdf reader) can access others ASD.

According to Some basics on Android storage system it is not possible.

The Activity Starter enables you to call another app, here a pdf reader. The pdf reader app now must read a pdf file, which is stored in the ASD of another app (your app).

Just add a screenshot of an example project, which uses the activity starter to read a file from the ASD into this thread including aia file, so everyone can check… Thank you…

Taifun

Okay. Here is video.

Longer video

Hi Taifun, i shared this .aia:
PdfCreator.aia (19.9 KB)

When Screen1 Initializes it creates just a bunch of labels on an arrangement
When Button 1 is Clicked it will use AdvancePDFCreator extension by @shreyaa
to generate a pdf inside the ASD directory
When the file is generated it will use Activity Launcher to open the file in ASD with an external app.

I’ve tested it on companion and on a generated apk on a Xiaomi Note 11 (Android 11):
The app doesn’t have any permission enabled:

And the pdf reader (wps office and google drive) have enabled media files read permissions (not all file permission).

I understand the basics of the new storage system. I don’t know if i’m wrong but as far as i’ve researched The ASD directory is encrypted and can only be decrypted by the app itself.
If you try to open the file with an external app it is not possible because of that ecryption. But when done trough an Activity you’re sending that file specifically, uncrypted and capable of being read by the external app.

1 Like

Android 11 and 12:

1 Like

Thank you for your tests…
Great to see that it is working…
However I do not understand, why it works…

Taifun

wonderful, just missing file:// to work with start Activity