Introducing the StorageAccess Extension create by (me)Mr_Koder
The StorageAccess extension is a valuable addition to MIT App Inventor, offering simplified storage permissions management and Android SDK version retrieval. With this extension, developers can effortlessly handle storage-related tasks and ensure compatibility across different devices. Let's explore how the StorageAccess extension simplifies storage access and enhances App Inventor projects.
Clarification
Starting from Android 11 (SDK level 30), Google introduced scoped storage which limits access to external storage by apps for better privacy. Here are the details:
Apps can still read and write files in their own specific directories in external storage.
For media files (Images, Videos, Audio), apps can use the MediaStore API to access shared storage.
For non-media files, apps need to use the Storage Access Framework (SAF) to interact with files. This allows users to select specific files or directories that your app can access. (solved by this extension)
RequestStoragePermission
This method is used to request storage permissions from the user. If the Android SDK version is below 30, it requests the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions using ActivityCompat.requestPermissions() . If the Android SDK version is 30 or above and the app does not have the necessary permission to manage external storage, it opens the system settings page for the user to grant the permission.
OnManageExternalStoragePermissionGranted
Event is triggered within the StorageAccess extension to notify the app when the user grants the manage external storage permission.
CheckStoragePermission
this method is used to check the storage permissions of the app. If the app has the necessary permission to manage external storage on Android devices with SDK version 30 or above, it triggers the OnManageExternalStoragePermissionGranted() event and reports that the permission has been checked and granted through the true event. Otherwise,
it triggers the false event to indicate that the permission is not granted or the device's SDK version is below 30.
OnPermissionChecked
event is triggered within the StorageAccess extension to notify the app when the permissions have been checked. It provides the app with information about whether the required storage permission is granted or not,
I didn't see the video earlier.
If you are not able to access files even after using SAF Picker then you have done something incorrectly in your blocks.
This extesnion does not directly deal with the Storage Access Framework (SAF). Instead, it focuses on managing storage permissions and retrieving the grant access status.
I think you should be more specific about your words.
If you are using SAF then there is no need to ask for MANAGE_EXTERNAL_STORAGE permission, but in the preview video you have shown that you were unable to upload file without this permission. How is that even possible?
It all seems so confusing to me.
You are correct, I know this,
Cause Google’s policy requires that apps justify the need for this permission and demonstrate core functionality that requires such broad access to manage all files. Without a legitimate need for this permission, apps may be rejected from the Google Play Store.
Hello, I stumbled upon this post created by you nine months ago. Thanks to your extension, I managed to complete my app. However, I still have some issues, and I kindly ask if you could please send me the AIA file of the video so that I can better understand the functioning or the logic of your extension. Let me explain further, I am currently unable to find the logic "if the permissions are granted, then do". Best regards.