File access to external storage

Hello everyone,

I am relabeling my request with the correct label “ANDROID”

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

if (RuntimePermissions::isGranted(RuntimePermissions::readExternalStorage))
   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 probably due to the fact that “file” is not selected by the user via a native browser and therefore does not receive the necessary permissions.

I would like to have access to /sdcard/andoid/data/. Is this still possible as a fixed path (with user permission, of course), or is this only possible with user selection (result path not fixed) via the native file selection dialog?

Thank you very much.