Anke
August 25, 2021, 3:06pm
1
How do you create / open (non-media) files using the Storage Access Framework (SAF), especially on Android 10+?
Reason for asking:
Many apps need access to files in the external storage that were created by other apps.
The question is aimed in particular at the Niotron team .
5 Likes
Yes you are write @Anke and also i am not expert in work of files accessing or any other work/ function in which files are required but still i know a little
i am tagging Staff here @NiotronStaff
please resolve the query
1 Like
Souvik
August 26, 2021, 6:48am
3
Well actually what we did is fixed few issues that was in the code to work in the android version that are compatible, but yea, apps targeting API 30 seems to have the same issues as the Appinventor test server, because of restrictions in accessing file in the Android 11 devices. We are still waiting for Appinventor to deal with it
1 Like
Anke
August 26, 2021, 6:51am
4
Ok, I’ll ask this question again in the AI2 forum.
1 Like
Anke
September 15, 2021, 3:14pm
5
Here is a new and important post from Evan Patton (MIT team) regarding the File
component that anyone on the Niotron team should take a closer look at:
@Souvik @Krish …
opened 02:44PM - 15 Sep 21 UTC
help wanted
issue: noted for future Work
status: forum
feature request
affects: ucr
priority: medium
**Describe the desired feature**
<!--
Describe the feature that you'd like t… o see implemented for App Inventor. More detail is useful as it allows us to better understand the complexity of the task.
-->
Newer Android versions lock down file access. There is a Storage Access Framework that allows the user to pick a file from the file system and grant the app access to that one file (or directory). It would be good if we implemented a new FilePicker, similar to ImagePicker, that uses the Storage Access Framework to prompt users to pick files for creation/editing/deletion in an app, in compliance with the latest best practices for file access in Android 11+.
**Give an example of how this feature would be used**
<!--
How would a teacher or student use this feature?
-->
An example app might include loading a CSV file for doing some mathematical analysis (or charting, once #1776 is merged). Picking the file from the filesystem is presently not available in core App Inventor.
**Why doesn't the current App Inventor system address this use case?**
<!--
Explain why the use case cannot be completed using the features of the current system.
-->
Previously, one might be able to provide a path directly to a file, but newer restrictions in Android make this no longer possible. The user must give explicit access to a file outside of the app's scoped storage.
**Why is this feature beneficial to App Inventor's educational mission?**
<!--
Because MIT App Inventor is aimed at educational use, we prioritize development of features with an educational benefit. Help us understand how your feature request relates to our mission.
-->
The inclusion of the new component alleviates some pressure around file access in newer versions of Android, and can also serve as a launching off point to discuss access control, security best practices, etc.
5 Likes
Fortunately I am also working on SAF related extension and most of its work is done.
Implemented:
SAF file picker (Tree method)
Take persistable uri permission (so you don’t lose access to file after reboot)
Check read and write access
Build document’s uri
IsDocumentUri , IsTreeUri and IsChildUri methods
Create document (File and Dir)
Delete document
Write to File
Read from File
Listing files
Rename Document
Copy document
Move document
Get mime type, display name,size and last modified time
5 Likes
Waiting for your extension
1 Like
Anke
September 16, 2021, 11:38am
8
This is excellent news.
I am excited …
2 Likes
Extension has completed alpha phase.
5 Likes