After SDK33: required storage permissions on Android 13+ (READ_MEDIA_...) missing

this is an extension by @bodymindpower, which was published in the N community (sorry, I’m not allowed to say that name here ;-))

see also the link here

Taifun

1 Like

I want to express my sincere efforts in trying the blocks before reaching out. Initially, I attempted the blocks you recommended; however, I encountered a hurdle as I couldn’t locate the ReadMediaPermission1.Sdk Version Block. Following your clarification on these points, I made another attempt, and the Audio Permission is now functioning properly.

However, I encountered a secondary issue where the notifier did not prompt me for the WriteExternalStorage permission. Subsequently, when attempting to play the recorded sound, I received a permission pop-up. Upon granting permission, the sound did not play initially. Strangely, it only played after stopping the recording and trying to play it again.


This image depicts a popup that emerges when I initiate the playback of the recording.

I’m having difficulty comprehending the process of acquiring this read permission, along with understanding how to obtain all three permissions. Could you kindly provide guidance on implementing these actions through the use of blocks?

I appreciate your assistance and would be grateful for any guidance or insights you can provide to address this matter. Thank you for your time and consideration.

Thank you in advance for your help @bodymindpower

Certainly, I found the extension on the N… community :stuck_out_tongue:, however, as mentioned by bodymindpower, I can alternatively utilize the Device_Utilities component from Kodular. Thanks @Taifun for been involved in the issue.

As I have already explained twice, I have shown all the required blocks. READ permission on Android < 30 is granted implicitly once WRITE permissions is granted (so it no longer needs to be requested).

And once again: On Android 11+, no storage permissions are required for files that were created by the app itself.

If my blocks are used exactly like I showed and there are still problems, there is a bug somewhere with Kodular and/or WRITE permission is not declared in the Manifest for Android < 30. However, this shouldn’t be the case, at least not if you use my DeclareReadWrite extension.


And next time please show all relevant blocks completely.

Thank you very much for your dedicated efforts. I truly appreciate your commitment to guiding me through the entire process. Regrettably, I haven’t been able to grasp it fully yet, and I apologize for that.

I have attached a test AIA file that I specifically created to evaluate recording, storage, and read permissions. I kindly request your assistance in identifying and rectifying any issues. Two of your extensions are integrated into this project. Despite my attempts and thorough research on the Kodular community, I have been unable to make it work or comprehend how to implement it.

Your support in resolving this matter would be immensely valuable. I believe it will not only benefit me but also assist others in understanding the complete process of recording, playing, and displaying files in the app.

Only essential blocks and extensions are included; without them, the problem cannot be resolved, following the guidance provided by @Taifun

Recording_Test.aia (120.9 KB)

  1. A slash (/) is missing, so the sound recording is not saved in the ASD.
  2. The Sound component incorrectly requests READ permissions for the Shared folders on Android 11+, even if the file was created by the app itself. (This wouldn’t happen e.g. with the TaifunPlayer extension.)

If you want to accept this (bug), you have to grant READ_EXTERNAL_STORAGE also on Android 11 & 12 and READ_MEDIA_AUDIO on Android 13+.


So, as I said, if my blocks wouldn’t work, there must be another bug in Kodular. QED

In which part is it absent? Is it within this block?
blocks(9)

However, there’s nothing I can do in that regard, correct? Should I consider substituting the player component with the TaifunPlayer extension to address this problem?

I’m genuinely unsure about how to carry out that task, which is why I shared the AIA file. I kindly request, as a favor, could you please perform the necessary steps in the AIA file and send it back to me? I’m struggling to comprehend the execution process.

Sure, if it doesn’t function as expected, I’ll approach Pavi for assistance in resolving the issue.

To find it out yourself, use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing and Debugging

Yes
Taifun

And again, yes.

Following your suggestions, I implemented the following changes in the app:

Added a slash (/)
Integrated the TaifunPlayer extension
Incorporated your ReadMediaPermissions extension and declared those permissions on the second screen.

Despite these efforts, the issue persists and, in fact, has escalated with more errors than before. At this point, I understand that resolving this may require your intervention. Therefore, I kindly request your assistance in fixing it, preferably within the AIA file. This way, I won’t need to create additional threads due to my inability to resolve the problem.

If you can address the issue within the AIA file and share it in this thread, it would greatly benefit not only me but also others seeking a similar solution. I’ve also had a discussion with Pavi, and he has expressed his commitment to prioritize and resolve this permission issue promptly.

Recording_Test_Final.aia (145.9 KB)

@Taifun @bodymindpower

Please be more specific
If you are asking for help, I recommend you to make it as easy for others to be able to help you …

You probably will get more feedback then…

which means in your case post a screenshot of your relevant blocks…

To download the aia file, upload it to Kodular, open it, do some bug hunting for you, etc… this takes time, and most people will not do that…

Thank you.

Taifun

1 Like

And they are?

Try this one:
Recording_Test_Final_2.apk (4.6 MB)

1 Like

That’s truly fantastic! It’s now running smoothly without any errors. I have complete confidence that only you could achieve this, and I’m incredibly grateful for your efforts in resolving the issue. Could you please share the solved AIA with me so that I can seamlessly integrate it into my project?

Additionally, I mentioned earlier that I lack a device with a version lower than Android 11 for testing. With these improvements, can I expect this method to work seamlessly across all Android versions without encountering any errors? Once again, thank you so much for your invaluable assistance.

@bodymindpower

Kindly share the AIA containing the finalized solution you’ve completed, allowing me to integrate it into my project.

I think you actually already have all the information you need to make the few adjustments yourself.

1 Like

Thank you immensely; it’s functioning perfectly now. I just have two inquiries:

  1. Is it no longer necessary to include the ReadMediaPermissions Extension in the app, as I couldn’t find any blocks related to it?

  2. Can I be assured that this method of yours will operate seamlessly across all Android versions? Unfortunately, I lack testing devices for versions other than the one I currently have.

Thank You, once again for your help. @bodymindpower

Yes, to both questions.

1 Like

I extend my heartfelt gratitude for your diligent efforts and the comprehensive solution to the problem. :pray:t2:

A post was merged into an existing topic: FTP Not working After SDK 33