No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Cordova object is undefined on Android app

    Framework
    2
    7
    803
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • I
      iamyohanarias last edited by

      Hey! I have an built Android app that it can’t to access to cordova object, it appears undefined. I want to use the cordova-plugin-file to download files but it doesn’t work since this error. I’ll apreciate your help

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @iamyohanarias last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • dobbel
          dobbel last edited by dobbel

          How and where are you trying to access the cordova object? If you post code samples people here will be able to help you better.

          btw here’s the plugin’s doc:
          https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/

          Did you try:
          window.cordova

          I 1 Reply Last reply Reply Quote 0
          • I
            iamyohanarias @dobbel last edited by

            @dobbel said in Cordova object is undefined on Android app:

            How and where are you trying to access the cordova object? If you post code samples people here will be able to help you better.

            btw here’s the plugin’s doc:
            https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file/

            Did you try:
            window.cordova

            This is a download file method

            this.$api.get(`file2/${fileName}`, { responseType: 'blob' }).then(res => {
                    console.log('respondio', this.$q.platform.is.desktop)
                    var blob = new Blob([res])
                    this.saveBlob2File(fileName, blob)
                    this.$q.dialog({
                      title: 'err',
                      message: this.$q.platform
                    })
                    // this.$q.loading.hide()
                    if (this.$q.platform === undefined) {
                      console.log('aqui')
                      this.saveBlob2File(fileName, blob)
                    }
                  }).catch(function (err) {
                  })
            

            The above method calls to saveBlob2File function

            saveBlob2File (fileName, blob) {
                  // var vm = this
                  this.$q.dialog({
                    title: 'saveBlob2File',
                    message: window.cordova
                  })
                  this.$q.dialog({
                    title: 'saveBlob2File2',
                    message: this.$q.cordova
                  })
                  this.$q.dialog({
                    title: 'saveBlob2File3',
                    message: cordova
                  })
                  var folder = cordova.file.externalRootDirectory + 'Download'
                  window.resolveLocalFileSystemURL(folder, function (dirEntry) {
                    console.log('file system open: ' + dirEntry.name)
                    this.createFile(dirEntry, fileName, blob)
                  }, this.onErrorLoadFs)
                }
            

            There is 3 dialogs modal, it shows undefined three times

            dobbel 1 Reply Last reply Reply Quote 0
            • dobbel
              dobbel last edited by dobbel

              Looking at your code I can’t come up with any reason why it’s undefined.

              a few things you can try:

              1. remove the plugin , and install it again . ( make sure it it really gone from the FileSystem and in the config.xml and/or package.js inside src-cordova)

              2. remove the android platform completely. and add it again

              3. make a github repo so I or someone else could try it out.

              1 Reply Last reply Reply Quote 0
              • dobbel
                dobbel @iamyohanarias last edited by

                @iamyohanarias I guess you solved your problem.

                I 1 Reply Last reply Reply Quote 0
                • I
                  iamyohanarias @dobbel last edited by

                  @dobbel Yes my friend. I deleted the plugin and I was reinstall it. Thank you for tour help

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post