Android manifest changes not updated

Hello everybody!

I’m very new with ionic, but I’m coming from cordova and react. So I tried to recreate a simple app with ionic-react. I now want to read a directory structure and manage files. I added the required permissions in the android manifest file. Problem is: in visual studio, using the ionic extension for debugging, the console says the permissions are not set and to add them in the manifest. ??? What’s more, the application running on a real device does not ask for any permission as it used to do with cordova. I’m running an android 6, so everything should be granted/asked from the manifest file, not at use time…

Any idea why the AndroidManifest.xml file seems to be ignored?

Thanks for your help!

Here the test code:

import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
import { AndroidPermissions } from '@awesome-cordova-plugins/android-permissions/ngx';


export async function readDirectory(): Promise<string[]> {

    const toto = new AndroidPermissions();

    toto.checkPermission(toto.PERMISSION.READ_EXTERNAL_STORAGE).then((result) => console.log("READ_EXTERNAL_STORAGE", result)).catch(err => console.error(err));
    toto.checkPermission(toto.PERMISSION.WRITE_EXTERNAL_STORAGE).then((result) => console.log("WRITE_EXTERNAL_STORAGE", result)).catch(err => console.error(err));

    toto.requestPermissions([toto.PERMISSION.READ_EXTERNAL_STORAGE, toto.PERMISSION.WRITE_EXTERNAL_STORAGE]).then(async () => {
        const content = await Filesystem.readdir({
            path: "Downloads",
            directory: Directory.ExternalStorage
        });
        console.log(content);
    });


    return [];
}

The ‘checkPermission’ result are ‘hasPermission’ However, the ‘readdir’ failed.

What plugin are you using to read directory? You need to provide code example and try to recreate your issue in order for anyone to help.

Thanks. I updated my post.

You may have forgotten to add some lines of code to the AndroidManifest.xml file. Since your using the @capacitor/filesystem, you need to add these lines:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

More info can be found in the docs.