Saving and reading files with android 11

I tested with 2.61

Anke i did try both of your examples and they worked - thanks.
when i tried mine with your changes it did not because i missed that LEGACY setting in the default screen. i do have multiple screens. this hint i found in another of your responses.
now i took the first block out as you suggested and it still works - great.
i think this all now makes me be able to finish my project for the most part.

if you don't mind there are still 2 open issues related to this:

  1. i still have not found a guide on how to update an existing project with a new extension ( i asked that one before) and
  2. i use the the taifinscreenshot block and that still comes up with "open failed...EPERM operation not permitted" this is running the apk and it is a different screen in the same app

image

thanks again for you patience and help to solve my issues

Erhard

For your two open issues:

  1. Updating an existing extension
  • Download the latest version of the extension
  • Open your project in App Inventor
  • In the designer palette on the left, scroll down to Extensions
  • Click on import and select your latest version from your computer
  • If all goes well, you should get a notice that your extension has been upgraded
  • If it fails, you may need to contact the extension developer about this, or worse case the new extension is not compatible with the previous version. In this latter case, you will have to uninstall the version you have, then install the new version. This will mean a lot of work in the blocks editor! Make a copy of your project and save to your PC before starting this.
  1. Taifun Screenshot
    You have another topic for this here
    Taifun Screenshot not working (for me)

Please ask questions about this there

1 Like

you need to do it this way:

2 Likes

Anke, yes i tried that one and it does not go well. complains about "duplicate...."
and i cannot afford to just delete it and rebuild my code.

with your help i fixed my file issues and that is good enough for me. i was somehow hoping the newer taifunFIle would possibly do all this internally. problem with current fixes is that during developing the file function do not work and i get funny errors that go away in the apk

overall the MIT appinventor is pretty amazing. in one screen i have about 1000 bocks and i think that is about the limit one can comfortably work with the appinventor. i m missing break points etc for debugging but Do IT is not bad and there i snot an easy find function that jumps to the right block from what i am reading.

ok i will try your suggestion, thanks

It will definitely work.

Do you use the latest (current) extension version?

wow i am back again with the same problem - error 2104 "cannot write to ....."
for whatever reason the program was working flawlessly in companion and as app with reading and writing. then today i loaded the extension "KOI location sensor"
and suddenly i get the same file writing issue in the app. in the companion it works. this affects also the other screens with file writing.

then i tried to remove the extension but the delete checkbox is greyed out - so how to delete/remove an extension.
however could it be a coincidence ?

who knows but that file handling is bitterly unstable i feel.

see before it worked not in companion and app
then it only worked in the app and then for unknown reason it worked in both environments
and no only in the companion
i tried filescope legacy and shared - nothing works
manifest on screen1 is set to legacy

any ideas what to do?

btw the KIO4 location sensor extension works much better than the original one - see my other post if interested.

thanks
erhard

forgot to add
this is in my screen initialize block
image

ok it works now - i thought about deleting the post but i leave it.
here is what happened
i changed the filename from "Motiontrack.csv" to "Motion2track.csv"
just to make it different and it works - how is that possible.
during my debug efforts i even had the phone restarted

i changed the name back to "motionTrack.csv" and it still did not work
then i deleted the file in totalcommander and then it worked.
so i conclude the file was somehow corrupted - great that took my about 4 hours now

1 Like

It is possible to share the file, I tried but it gives me an error.
If possible, you can post the blocks please.
Will there be a way to share files created in any directory?
Such a useful function cannot not exist, otherwise what are created to fire the .csv if then the user has to go and look for them, copy and send them by closing the app.

On Android 11+, a non-media file can be saved in one of the shared folders (like /Download or /Documents) only if this file was not previously created by another app. If the app was un-/reinstalled, this newly launched app is again a new app which cannot overwrite the previously saved non-media file. This file

  1. must first be removed manually (by the user) or
  2. must have a different name (so I would recommend adding a timestamp).

@Anke already mentioned it in post #3.

No, I do not think so.

Joannes you are right i had the same thought after i posted, i remembered Anke's comment and her app but did not understand it at the time because non of this exists in the MS windows OS. file is file no matter who created it. now at least i understand that part. But as i mentioned i had the case where companion and app could access both the same file at least for a while. maybe i can replicate it again

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.