How to access SD card root directory with Ionic 2

Hello.

I’m developing a simple App with Ionic 2 which, among other things, has the functionality of a file browser set in the external storage of the device. The problem is that when I call the native method File.externalRootDirectory, instead of the root directory of the Sd card, I’m getting the root directory of the internal phone storage. This is the code:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { File } from '@ionic-native/file';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

    private dirs: string[];
    nativepath: string;
    
    constructor(public navCtrl: NavController, private fileCtrl: File) {
         this.goToDir("");
    }
    
    public goToDir(dir: string)
    {
        this.fileCtrl.listDir(this.fileCtrl.externalRootDirectory, dir).then(
            (list) => {
                this.loadList(list);
            }
        );
    }
    
    public loadList(list: any)
    {
        for (let i=0; i<list.length; i++)
        {
            this.dirs[i] = list[i].fullPath;
        }
    }


I’ve been testing this with Android 4.4 and 6.0. I have both ionic and cordova updated to the latest.

As I said, this code doesn’t return the root of external storage, it returns the root of internal storage (dirs: /Android, /DCIM, /Download, etc). I’m new to Ionic (and web development with angular) and I don’t see what I’m doing wrong. So I’d be glad if someone can help.

Thanks beforehand.

Any chance this is related to ionic-native #1516?

If it’s related, I don’t see how. But I might try to run a release build to see if there’re any differences.