Read file from usb-drive

Hi

Can anyone help me please.
In my Ionic1 App, I would like to open a pdf-document which is located on an usb-drive which is connected to the mobile device.

How would I achieve this ?

Kind Regards
Joost

use file plugin and specify path of USB device as external memory to manage any type of file.

Would you have a code sample to achieve this ?

just read the document mentioned in bellow link. The directory structure of Android device is also mentioned in it. You certainly can do it with proper reading.

http://ngcordova.com/docs/plugins/file/

or

Hi

Via the properties of the cordova-file-plugin you cannot access the usb-drive.
I hope someone else can help me out.

How can I access a directory / file on the usb-drive which is connected to the device ?

The root for the files on USB drive(External Source) will be / as per document of plugin.

So how would you change following code to be able to read the contents of the usb-drive ?

    vm.leesDir = function leesDir(path) {
        $window.resolveLocalFileSystemURL(
            cordova.file.externalRootDirectory,
            function (dirEntry) {

                var dirReader = dirEntry.createReader();

                dirReader.readEntries(
                    function (entries) {
                        console.dir(entries); // directory entries
                    },
                    function (err) {
                        console.log(err);
                    }
                );

            },
            function (err) {
                console.log(err);
            }
        );
    };

How are you calling this function

It was originally :

vm.leesDir = function leesDir(path) {
$window.resolveLocalFileSystemURL(
path,
function (dirEntry) {

            var dirReader = dirEntry.createReader();

            dirReader.readEntries(
                function (entries) {
                    console.dir(entries); // directory entries
                },
                function (err) {
                    console.log(err);
                }
            );

        },
        function (err) {
            console.log(err);
        }
    );
};

and calling via

leesDir(’/storage/’);
or
leesDir(‘file:///storage/’);

When I connect the USB-drive, the files are located on

/storage/02DD-A5BD/

So when I call leesDir(’/storage’), I would like to get a listing of ‘/02DD-A5BD’ with it’s files and subfolders.
However this doesn’t seem to work.

Try removing the memory card inserted in the phone

There is no SdCard inserted at this moment.