How can I read/write my text file in /Documents?

My blocks do not work

try the relative path /Documents/Appunti.txt


it's the first attempt I've made

If the text file (Appunti.txt) is created by the app itself, it is no problem to read it with the File component and / or to save new text (in the shared folder /Documents).

If the text file is not created by the app itself, but was copied into the /Documents folder by another app or manually, there are 3 options (since the app, as you said, is only for your own use):

  1. Change the targetSdkVersion to 29 (easiest way).

  2. Declare MANAGE_EXTERNAL_STORAGE in the Manifest and request this permission (to get full access to all files / directories).

  3. Save / copy Appunti.txt (manually) in the ASD, eg here:
    and copy / move it (in the Screen.Initialize event) to the shared folder → /Documents (releative path) using the app
    /storage/emulated/0/Documents/Appunti.txt (absolute path).

1 Like

How can I create it ? by saving ? I tried without success

I don't know how can I do 1,2

You could use APK Editor Studio


Try this APK (targetSdkVerion = 29).
Put "Appunti.txt" in the folder /Documents.

1 Like

It runs well

This is the manifest of my apps

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:maxSdkVersion="29" android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application android:debuggable="false" android:icon="@mipmap/ic_launcher" android:label="PROVA" android:name="" android:networkSecurityConfig="@xml/network_security_config" android:preserveLegacyExternalStorage="true" android:requestLegacyExternalStorage="true" android:roundIcon="@mipmap/ic_launcher" android:theme="@style/AppTheme">
    <uses-library android:name="org.apache.http.legacy" android:required="false"/>
    <activity android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize" android:name=".Screen1" android:windowSoftInputMode="stateHidden">
            <action android:name="android.intent.action.MAIN"/>
            <category android:name="android.intent.category.LAUNCHER"/>
    <provider android:authorities="appinventor.ai_andrea_patelli.PROVA.provider" android:exported="false" android:grantUriPermissions="true" android:name="androidx.core.content.FileProvider">
        <meta-data android:name="" android:resource="@xml/provider_paths"/>

what changes I have to do ?

If I understand well I can recompile my old projects, edit the apk as you showed and they can run with android 11.

Yes, but why don't you just try it yourself?
Of course, these apps cannot be released in the Play Store if they were published there after July 31, 2021.


I tried, I can read but not save, permission denied, please enable it in settings app.

No problem for me

1 Like

You must set DefaultFileScope to Legacy, as I've shown in my test aia:


Note: This is of course a bug, that has to be fixed soon.


Thank you, it runs, now I can update my old projects without problems

1 Like

Are you sure you found the solution? :upside_down_face:


What do you mean ?
I recompiled some old projects, I changed DefaultFileScope and targetSdkVersion, the apps run well.
I would prefer to avoid all these steps, but I don't understand how and if it can be done.
You said:
Declare MANAGE_EXTERNAL_STORAGE` in the Manifest and request this permission (to get full access to all files / directories).'
How ? I tried without success

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    android:maxSdkVersion="28" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

Can you answer me?

which questions are still open?
how to modify the manifest has already been answered in post 8 here

and to request the premission just use the AskForPermission method from the Screen drawer

Now I have a solution, but it's not a good solution as Anke said, I would read/write my files in /Documents without APK Editor