Can 2 apps made with ai2 share files with each other in Android 11?

Hi,

I'm returning to using app inventor after taking quite some time off from it, so pardon me if my question is obvious.

Is it possible to have 2 separate apps made with app inventor share files with each other? Particularly if using Android 11 and once the changes to file storage scope are put into full effect?

I had been work on 2 separate apps, that are both quite large.

-The first communicates with an arduino and controls a 2 axis cnc via bluetooth.
-The second one is in progress and will hopefully produce a sort of gcode and store them in separate files.

I'd like to have the first app be able to interpret files produced by the second.
I'm not sure what a good strategy would be to go about this.

Thank you for any guidance.

edit:
You can see the first app in action in this video on youtube: Auto Table Saw Fence

@Rich_Want
Hi if you want make file sharing app
I would strongly recommend using FTP with a DNS server.
It can be easily made with something like 000webhost.com etc...

However if you want to share the files in your app then you can use
@Taifun's FTP extension for that
App Inventor Extensions: FTP | Pura Vida Apps

Hope it helps :slight_smile:

Regards Pratyush

1 Like

For Android 11....two apps same device
Try this - uses a text file and the File component and Taifun's File extension (there may be a better way...)

On first app, save a text file to the ASD, then copy this to the sdcard ( I used a different filename to show what was happening). Use this block.

On second app, you reverse this by copying the file on the sdcard to the ASD for the second app, then open it with the File component.

If you need to keep the file data current for both apps, then you will need to use both sets of blocks, but change the order of doing things.....

All the forward slashes / are important to ensure you save to / fetch from the correct directories.

(note, I only tested this with one app, hence the different filenames at each stage)

1 Like

This will no longer work when AI2 is targeting API 30 (Aug 2021).

Blocks / screenshot

And what reason should there be to save in the (root dir of) external storage?
/storage/emulated/0/

See also here:

https://www.raywenderlich.com/10217168-preparing-for-scoped-storage

Thought there might be a gotcha in there somewhere.

What do you have that is different in your setup, that demonstrated the difference. I used an Android 11 device in testing, with companion? Do I test compiled ?

And what reason should there be to save in the (root dir of) external storage?

To give file access to the second app - it would not have access to the ASD of the first app.

The simple "gotcha" is that if AI2 targets API 30 (targetSdkVersion = 30) it will stop working on Android 11 devices. And that will soon be the case.

Do you have an "on device" solution for the OP ?

@TIMAI2 See here:

https://developer.android.com/training/data-storage/use-cases#handle-non-media-files

1 Like

I understood from the attached text

that new methods of recording and reading by Medistore are needed, which are built into Android. I think that components saving files and reading will have to be modified, or we will need to use some extension.

But here can read that Android will bring the correction and it will be easier :grin:

So I think you have to wait until Android will introduce amendments and MIT target AI2 on API30. Then everything will be clear.

1 Like

Honestly, I still do not understand it. So what can you do to read the files we recorded in a different application as you can do it in Android 9? Ask for a new permission that will enable this and use system selector?

Thanks for the links Anke, although, as per Google usual, they do seem to contradict each other.

The first says that from sometime in May, apps targeting Android sdk 30 can request MANAGE_EXTERNAL_STORAGE permission

The second says:

I guess we just do what we can do until it breaks, then do something else.....

https://support.google.com/googleplay/android-developer/answer/10467955

Thank you Anke.

I am off to do something analog on my 60 year old car, nothing digital in sight, no confusing updates, all I need is a small light bulb and two pieces of wire :smiley:

1 Like

Yes, the constant updates and tightening of storage usage are really irritating and annoying.
The user comments on Scoped Storage on YouTube say the rest.

I really appreciate you all taking the time to answer my question. Thank you Anke, TIMAI2, Patryk_F and PRATY_PROGRAMME_S_LA.

I'm glad I'm not the only one that has been confused by how this will work in the near future. I think for now I will simply do as TIMAI2 suggested and if / when my apps break, come up with a system using google drive to save and retrieve files, though I'd like this system not to have to rely on wifi if possible. Hopefully we will have a better idea soon of how how to approach this using ai2.