Write works on Motorola Android 15 but not on pixel9

Try this simple test app on your test devices with Android 11+ and post a screenshot (after pressing button "Request WRITE permission"):

Blocks

ok you are right - thanks for the illustration.

now what? my program for whatever reason is writing the data to the phone internal memory and i see no error. is that because of all my many attempts that for what ever reason it no works?
would i see the error again if i uninstalled the app and reinstall?

so what do i really need to change in my code now to make it work. i have to admit i am confused.
thanks
erhard

So can I write because i gave permission in the app info screen under restricted permissions?
Your app does not request any permissions in that appinfo screen

No
To write in shared storage does not require permissions anymore on newer devices

What about providing an updated screenshot of your relevant blocks?

Taifun

ok here i put the relevant blocks together
first i define the filename as global variable with a "/" at the beginning (it also works without forward slash and then i use the filescope = legacy
i only use the appendTofile block command to write data
you are saying i can omit the PERMISSION request but what if some one wants to install it in an older android version (<10) ?

is that what you wanted to see?


Only ask for that permission for devices < Android 11/ API Level 30

For example my tools extension offers a method for that

If api level < 30
Then ask for write external storage permission

Yes
Your question was

Use te MFile extension as mentioned earlier

Also be aware to not edit the file outside of your app... this will change the ownership and further append file attempts will fail... if you need this you will have to use SAF...

Also let me suggest you to clean up your blocks... and why are sone blocks black and grey?

Taifun

ok thanks - yes i saw the APILEVEL query in anke's example - very helpful.
you did develop many powerful tools - thanks.
i use your parser in the scientific calculator. maybe you remember my issues back at the time.

glad you mentioned that the file should not be used from another app. i did not expect this issue. in the scientific calculator i allow precisely to do that - edit userdefined formulae from within or outside the program - like on the PC and then import it to the phone. so using the SAF has other shortcomings or is it just better to use it in general? does it change the PERMISSION usage?

some blocks are black or grey because they are marked from the SEARCH function (some XOR color function i assume) - how else should i find them otherwise?

haha, cleaning up the blocks, honestly i am not sure how to do that. i think appinventor has a function which i used once and that moved my blocks all over the place, i think it order them by type.
i do have many leftover blocks in there from various attempts of doing things so they could go away but i have not found a clean structure other than what i use. bottom line is that i think the apps reached a size where app inventor block structure becomes troublesome.
i am open to suggestions.

Since your app is apparently not intended for the Google Play Store, simply request and grant the MANAGE_EXTERNAL_STORAGE permission. This should solve all your storage permission problems.

Plus, you won't have to delve into SAF.

thanks.
by manifest you mean the definitions under the APP INFO (long press app icon)?

i tried once to publish it on google play but the process is so tedious that i gave up. then i tried to publish it to the mit appinventor but it does not allow apps with extensions - go figure.
any suggestion where i could contribute my apps to?

The App Showcase category.

btw. is there a reason why these storage access features are not properly integrated into the appinventor? to me file read/write is a basic need in programming.
also if you allow me another question.
in regular PC programming it used to be common to have a helpfile included with a program. i have not seen any options where i could attach a separate text file that goes along with the app. i only recently saw that there is an ABOUT feature which can be used in a way for plain text explanations.

You should ask Google this question rather than App Inventor. These “user-friendly” storage access restrictions on Android are getting worse every year, which is increasingly annoying us all and has already caused many to switch to Apple (iOS).

you are right but i thought you expert guys are the influencers to talk to google. all i can do talk to a sales person and voice my unhappiness - that does not help at all.
so you are saying when using appinventor for iOS these problems are not there?

aren't these things discussed during developer conferences?