Write works on Motorola Android 15 but not on pixel9

I doubt it. You shpuld get the same permission error on any Android 11+ device, because WRITE permission no longer exists on Android 11+. It can/may only be requested on Android < 11. Storage permissions are no longer required for app-created (non-media) files on Android 11+.

Hmm, I doubt that too. Show your recent blocks and post the aia (and let me check this on my Pixel Pro device with Android 16).

here the link to the aia file
erhards_apps_v188_copy.aia
hope it works

the program opens in the scientific calculator. click on the upper right MAIN and then chose (6) Motiontracker.
before (filescope=shared) that caused the immediate 908 error - gone with 'legacy' setting on pixel andoroid 16 and my motorola android 15. my motorola never had any issues with 'shared'. i think i started the project with android 10 way back

First clean up your project, fix errors and post a simple (small) project that shows the (supposedly fixed) problem.

ok aren't you a little bit harsh now? :slight_smile:
not sure why you say supposedly fixed?
it always worked on my motorola phones from the last 10 years. it only showed error 908 on my friends pixel 9 xl (android 16) while i was using SHARED instead of LEGACY in the 4 FILESCOPE blocks that is all i am saying.

the 3 errors were 3 orphaned GETs which i now put into the trash so no more errors.
image
that should not ruin the project right and i assume the warnings are just warnings and should also not harm the project, right?

the write issues are related to the filescope = legacy which only happens in 4 locations - it is very time consuming for me to reduce the project artificially down because it also is not anymore the same project.
you can easily search to the 4 locations and see the blocks of interest.
as i said the program at this point works but you don't believe it. so when you install and run it does it give you an error or not - it should not?
i understand if you do not want to waste your time further on this issue so please accept my thanks for the help that made it work.
erhard
btw: your messages have a special positive effect on me because my niece name is ANKE too.

As I already said, if you request WRITE_EXTERNAL_STORAGE permission on an Android 11+ device you will definitively get a permission error. Changing FileScope doesn't change anything.

Of course, I get errors...

Android 13 and 16.


There's no need to test it on my other Android 11+ test devices. They'll display the same errors.

I don't think anyone wants to waste time unnecessarily here, and I certainly don't. But my interest is not to mislead or confuse (other) users, but to ensure they receive practical and understandable solutions.

1 Like

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?