ANDROID file access

Hello everyone,

I’m having a problem with file access on ext. using this code:

   if (!RuntimePermissions::isGranted(RuntimePermissions::readExternalStorage))
   {
     ...
   }
   else
   {
       DBG("PERMISSION GRANTED"); // this case is given
   }


AndroidDocument ad(AndroidDocument::fromFile(file));

if (ad.hasValue() && ad.getInfo().isFile())
{
    std::unique_ptr<InputStream> is(ad.createInputStream());
    DBG(ad.getUrl().toString(false));       //returns the correct URL
    if(ad.getInfo().canRead())              // returns false on Anroid 31, 36 
                                            // returns true on Anroid 24 
        is->readIntoMemoryBlock(fileData, -1);
}

The problem is likely due to the fact that the file is not selected by the user using a native browser, and therefore does not receive the necessary permissions.

Is there another way besides the sandbox storage location?

I would also like to have access to the file via the adb console.

THX.