Write works on Motorola Android 15 but not on pixel9

I have an older app that writes out a text file. Filename is
Document/motiontrack.csv

Since Android 10 that worked on my .Motorola phones including Android 15.
However my fiend cannot run it on his pixel9 pro max and gets error 908 permission write external storage denied.
I remember spending hours way back get this to work on the Motorola, so is there a new trick?
Thanks
Erhard

Show your relevant blocks

it is important to use the correct path to shared storage...usually it is /Documents/motiontrack.csv (see the s in Documents)
Also make sure the file does not already exist before trying to write the first time

which Android version? is this an older version? then you have to ask for write external storage permission

Taifun

thanks for the reply. on my motorola it was from version 10 to 15 - always worked.
his pixel 9 is 16.
i checked my filename it is
Documents/MotionTrack.csv
sorry for the missing 's'

here the blocks i use for the writing
image.

ok this app runs when installed with no issue but in companion if i run the permission block --> error 908
if i run appendtofile: error 2104

ok i understand and i was searching for the issue but there is so much stuff and often older so it seems not to bad to reopen a specific topic.
also as you know sometimes the companion does behave differently than the complete installation but i will improve.
for example when i was testing the contactpicker in companion and i dwelled in the selection process for more than 2sec the companion disconnected

I'm wondering that this was working...
because there actually is a bug in the file component for writing to shared storage, see also here Test on AI2 test server - targetSdkVersion=33 │ Aug 31, 2023 │ storage permissions - #22 by Anke

In the following thread @Anke recommends to use the MFile extension as workaround

Taifun

btw i am using the taifunfile1 extension - i never updated it since 5 years or so - do i need do update?

thank you
i switched all filescope blocks to LEGACY hope this fixes it - if not i will try the MFile extension

erhard

There is a golden rule: Always use the latest version

Taifun

haha, and i know another rule : don't fix it if it is not broken

oh that brings up another question - how to upgrade an extension? last time i did remove the extension and that deleted all the related blocks - that was bad.
sadly AI tells me that is the only way still today
erhard

Import the new version without removing the old version and magically the old version will be upgraded by the new version

Say greetings to your AI...

Taifun

oh beautiful - AI as usual says "oh you are right..."

good news - the switch to filescope=legacy fixed the problem on the pixel9 xl android16
so should i update the taifunfile1? are there other fixes in there that benefit my later?

thanks
erhard

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