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

After sdk 33, pdf file not opening and give error like reading permission denied

Reading permission denied, this error come in android 13 or 13+

Unfortunately we do not know what you are doing, because you forgot to provide a screenshot of your relevant blocks

Taifun

Which permission is required for pdf file on android 13

This depends on where it is stored and who the owner is of that file, see also Some basics on Android storage system

And

Taifun

On Android 11+, storage permissions for non-media files are not required (requestable). Either the non-media file (PDF) is saved by the app itself in one of the Shared folders (or the ASD), for which no storage permissions are required, or if the file was created by another app then SAF must be used.

If you had read my link, your question would have already been answered.

The changes on Android 13+ regarding READ permissions only affect media files.

Thread: App Description - Piano App Recording Permission Issue

Hello everyone! :wave: I’m currently working on a piano app that allows users to record, play, share, and save their recordings directly on their mobile devices. I’ve encountered a challenge related to permissions, and I’m seeking your expertise to find a solid solution.

App Features:

  • Record, play, share, and save piano recordings on your mobile device.

Extensions Used:
Extensions_2
Extensions

Blocks Implemented:

blocks(2)

blocks(3)

My Device Information:

  • Android 11+

Issue Description:
Upon opening the app, I’m not getting the usual permission popup; instead, a notification (Notification 1) appears if the permission is denied. I’ve explored various threads in the community but haven’t found a clear solution, especially regarding the method to save recorded files. I need a foolproof method with blocks that ensures compatibility across various Android versions, as I don’t have a device with a version lower than Android 11 for testing.

Seeking Solution:
I would greatly appreciate it if you could provide the exact method with blocks to handle permissions and ensure smooth file saving, considering the nuances on all Android Versions. Your insights and expertise will be a tremendous help!

Thank You

These blocks are all you need (as long as the audio files are created by the app itself).

However, if other audio files are also to be accessed by the app, READ permissions must also be requested and granted for Android > 10. For Android 11 and 12 READ_EXTERNAL_STORAGE and for Android 13+ READ_MEDIA_AUDIO. (In this case my extension ReadMediaPermissions is needed.)

1 Like

Actually pdf file download from server and store in download folder but when pdf file open in my app then show error that reading permission denied and pdf file not opened. This error only come out in android 13.

1db9e1b331cac0db90a5f308e06f1c90ab685e71_2_690x326

In this image, you’ve disabled the “record audio” block. What does this mean? Should I use the audio permission or the RECORD_AUDIO permission?

I couldn’t find the ReadMediaPermission1.Sdk Version Block. Can you help me locate it?

Additionally, I display all the audio files recorded within the app. Could you please guide me on how to do that? I’m quite confused. Here are the blocks I’ve used, though I realize they may not be correct.

Your guidance would be greatly appreciated. This will also benefit all Kodular users who record and display audio files in their apps. Thank you @bodymindpower

Thats not working. I’ve tried.

I have already shown you all the necessary blocks. How about you try it out first before asking questions that I’ve already answered.

1 Like

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