File plugin returns Directory List empty


#1

in my ionic app I just want to list all the files/folders in sd card, im using the cordova-file-plugin

the code is below

.controller('MyCtrl', function($scope, $cordovaFile) {

  document.addEventListener('deviceready', function () {

    
  console.log('sdsd');
  
  var myPath = cordova.file.externalRootDirectory; // We can use the default externalRootDirectory or use a path : file://my/custom/folder

window.resolveLocalFileSystemURL(myPath, function (dirEntry) {
	console.log(dirEntry);
     var directoryReader = dirEntry.createReader();
     directoryReader.readEntries(onSuccessCallback,onFailCallback);
});

function onSuccessCallback(entries){
  console.log( 'The magic will happen here, check out entries with');  
   console.log(entries);
}

function onFailCallback(){
  // In case of error
}
  

  });

});

http://ngcordova.com/docs/plugins/file/ in ngcordova file there is no function i found, so im using cordova javascript code in my ionic app,

The function returns empty array, i hae added the permission also, anyone had similar issue , pls help


#2

and the app does not ask for permission too