Hey, do we need external write permission to edit a file located in asd but trying to edit in any other app through activity starter? (Android 11) and is it allowed in sdk 30?
This is not possible because the ASD is only accessible to the app with which it was created.
See here: Some basics on Android storage system
/storage/emulated/0/Android/data/<packageName>/files/
which is in the External (private) Storage, but does not require READ_ / WRITE_EXTERNAL_STORAGE permissions. The ASD can only be accessed by your app and is automatically removed when the app is uninstalled.
But i’m able to open files from asd through activity starter but it doesn’t allow to edit.
and I’m able to also edit files in android 10
Show your blocks.
- Which Android version?
- With which app was the ASD created and
- with which app do you (try to) open which ASD?
- Companion or APK?
The ASD (App-specific Dir) is:
/storage/emulated/0/Android/data/<packageName>/files/
This means each app has its own ASD.
Btw, on Android 11 the ASD is no longer visible
(unless you are using an external file manager, such as Total Commander).
I have tested personally on Android 10 and 11, physical devices.
My app use any other 2nd party pdf viewer to open files from my asd.
In companion, it doesn’t work, if files are not already available in asd
What is → my ASD? Which ASD?
I don’t get it what you are trying to explain.
Btw, how about answering my questions.
Q -1 Which android Version
Answer - I have tested this block in android 10 and 11.
With /// I get only read access but works fine in both android 10 and 11
In Android 10, I get write permission also(ability to edit pdf) if I change /// to /, but in this case, block doesn’t work for android 11.
Q-2 With which app was ASD created?
Answer - Let call my app - x, and this block is from my app -x
Q-3 with which app do you(try to) open which asd.
Answer- I try to open files from my app -x’s asd in any pdf reader ( Adobe PDF reader etc) through activity starter.
Q-4 Companion or APK?
In case of APK, answer to Q-1 is applicable.
In case of companion, this block doesn’t work properly, if I install apk, download this pdf file in asd and after this step companion can open this file.
How pdf behave after opening file in(through) companion?
Answer- Answer to Q-1 is applicable.
Show all relevant blocks.
Android.intent.action.VIEW, Application/pdf are in designing section. Using mobile so couldn’t post it.
I have no issues on Android 9 and 11 to open a PDF, read and edit it.
If I use /storage/emulated/…
instead of file:///storage/emulated/…
I have less options to choose PDF-applications (that are installed on my test devices).
I didn’t ask for WRITE / READ permissions.
(Of course, the PDF apps need permissions, unless these can also write / save in the ASD.)
Okay, I’ll try this and let you know.
Thank you for help.
Classic… :
Me too learnt from your suggestion
Thank you
I tested /storage but in my android 11 device, it didnot work even after given full permission to PDF App.
is there alternative to fix this? Make a sub folder in download folder ? and what about permission ?
Is tough or impossible to get write permission in download folder in sdk 30?
Yes, you must use file:///storage/...
on Android 11,
as you found out yourself:
But if you use file:///storage/...
for Android 11 (API 30), what does not work?
As I said I, tested it on Android 11 (Pixel 2XL) and it works fine.
Which download folder? If you mean /storage/emulated/0/Download
then if will no longer work when Kodular targets API 30 (Android 11, Aug 2021). But Kodular ist still targeting API 29, so it should work for now.
If you mean the download folder in the ASD then it shouldn’t be a problem at all.
I can’t edit pdf.
Which PDF app do you use?
Adobe, xodo
In Adobe you can edit but it creates a new file with numbered file name, So basically no benefit