laren0815
laren0815

Reputation: 263

object window has no method resolveLocalFileSystemURL

I want to use the org.apache.cordova.file plugin for my ionic android app.

In addition i use the ngcordova extensions (It gives you simple AngularJS wrappers for the most popular Cordova and PhoneGap plugins available, where you can take a picture, scan a barcode, upload a file, turn on your flashlight, get your current location, and much more with just a few lines of code.)

I install ngcordova as you can see in the docs, and the "Barcode Scanner Plugin" works perfekt, but if i want to use the "File Plugin", i get always the exception:

object window has no method resolveLocalFileSystemURL

the code snippets inside the ngcordova extension:

      try {
        $window.resolveLocalFileSystemURL(path, function (fileSystem) {
          fileSystem.getFile(file, {create: false}, function (fileEntry) {
            fileEntry.file(function (fileData) {
              var reader = new FileReader();

I have added the plugin via

cordova plugin add cordova-plugin-file

and also i have added

cordova plugin add cordova-plugin-file-transfer

Upvotes: 1

Views: 2516

Answers (1)

Weng Fai Wong
Weng Fai Wong

Reputation: 640

Did you add the right plugin?

ionic plugin add org.apache.cordova.file

Also your controller needs to have $cordovaFile

app.controller('profileController', ['$scope', 'value', '$ionicPopup', '$cordovaCamera', '$cordovaFile', '$localstorage', function($scope, value, $ionicPopup, $cordovaCamera, $cordovaFile, $localstorage)

Upvotes: 1

Related Questions