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

    Example use cordova plugin

    Help
    5
    25
    16640
    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.
    • G
      gmferreir1 last edited by

      Thank you @rstoenescu all right here.

      1 Reply Last reply Reply Quote 0
      • G
        gmferreir1 last edited by

        @rstoenescu Call the cord this way is correct?
        export default {
        data () {
        return {}
        },
        mounted () {
        document.addEventListener(‘deviceready’, onDeviceReady, false)
        }
        }
        but it does not work

        show error: ✘ http://eslint.org/docs/rules/no-undef ‘onDeviceReady’ is not defined

        rstoenescu 1 Reply Last reply Reply Quote 0
        • rstoenescu
          rstoenescu Admin @gmferreir1 last edited by

          @gmferreir1 You don’t need to ensure that device is ready. Quasar takes care of it for you automatically. And anyway registering for that event in a component would be far too late in the life of an app. The error is displayed in your case because you’re registering a trigger with onDeviceReady which you didn’t define.

          Bottom line, you don’t need to register the event.

          1 Reply Last reply Reply Quote 0
          • X
            xereda last edited by

            I need a simple example of an implementation. I did not find anything with Quasar, nor in the issues, nor here in the forum.

            1 Reply Last reply Reply Quote 1
            • G
              gmferreir1 last edited by

              @rstoenescu Thanks, helped a lot, now I understand how it works. I was able to implement.

              @xereda follows implementation cordova camera, worked form me. Do not forget to add the plugin.
              Then run, quasar build, after cordova build

              export default {
              data () {
              return {}
              },
              methods: {
              test () {
              Dialog.create({
              title: ‘Warning’,
              message: ‘You are about to run out of disk space.’,
              buttons: [
              ‘Cancel’,
              {
              label: ‘Empty Trash Bin’,
              handler () {
              // empty the trash bin, yo
              }
              }
              ]
              })
              },
              onDeviceReady () {},
              getPicture () {
              navigator.camera.getPicture(onSuccess, onFail, {
              quality: 50,
              destinationType: Camera.DestinationType.FILE_URI,
              encodingType: Camera.EncodingType.JPEG,
              mediaType: Camera.MediaType.PICTURE,
              saveToPhotoAlbum: true
              })
              function onSuccess () {
              alert(‘success’)
              }
              function onFail () {
              alert(‘Failed’)
              }
              }
              },
              mounted () {
              document.addEventListener(‘deviceready’, this.onDeviceReady, false)
              }
              }

              rstoenescu 1 Reply Last reply Reply Quote 0
              • rstoenescu
                rstoenescu Admin last edited by

                Build your app just like any normal site. Make a build with Quasar CLI, wrap it with Cordova, learn Cordova CLI to make an executable for your specific platform(s) and just run it on your phone. There’s nothing specific that you need to do for Cordova. That’s one of the main power of Quasar. Help me understand what exactly you need. I just want to make you click to see the big picture, make you have that “A-ha!” moment. Quasar deals with lots of optimizations for your code so you won’t have to.

                X 1 Reply Last reply Reply Quote 0
                • X
                  xereda @rstoenescu last edited by xereda

                  @rstoenescu said in Example use cordova plugin:

                  Build your app just like any normal site. Make a build with Quasar CLI, wrap it with Cordova, learn Cordova CLI to make an executable for your specific platform(s) and just run it on your phone. There’s nothing specific that you need to do for Cordova. That’s one of the main power of Quasar. Help me understand what exactly you need. I just want to make you click to see the big picture, make you have that “A-ha!” moment. Quasar deals with lots of optimizations for your code so you won’t have to.

                  So I have direct access to the “navigator” object?

                  rstoenescu 1 Reply Last reply Reply Quote 0
                  • rstoenescu
                    rstoenescu Admin @gmferreir1 last edited by

                    @gmferreir1 again, no need to deal with onDeviceReady event. That is triggered way way before anything is drawn on the screen. Quasar and Vue itself couldn’t have even initiated if Quasar didn’t used that trigger when App starts. Please read about it in Cordova docs and you’ll understand why.

                    1 Reply Last reply Reply Quote 0
                    • rstoenescu
                      rstoenescu Admin @xereda last edited by

                      @xereda yep. Here’s a basic example with barcode scanner cordova plugin from quasar play: https://github.com/quasarframework/quasar-play/blob/dev/src/components/play/play-url-list.vue

                      X O 2 Replies Last reply Reply Quote 1
                      • X
                        xereda @rstoenescu last edited by

                        @rstoenescu said in Example use cordova plugin:

                        @xereda yep. Here’s a basic example with barcode scanner cordova plugin from quasar play: https://github.com/quasarframework/quasar-play/blob/dev/src/components/play/play-url-list.vue

                        How do I simulate this? Without having an Android device here?

                        rstoenescu 1 Reply Last reply Reply Quote 0
                        • G
                          gmferreir1 last edited by

                          @rstoenescu Now I understand completely, thank you very much for your time. The framework is show

                          1 Reply Last reply Reply Quote 0
                          • rstoenescu
                            rstoenescu Admin @xereda last edited by

                            @xereda android emulators. I’m not near a laptop but if you got android sdk installed and configured with an emulator, “cordova run” should trigger it. Note that you need an actual phone for some plugins like barcode scanner since the emulator can’t emulate taking photos with the camera, obviously.

                            X 1 Reply Last reply Reply Quote 0
                            • X
                              xereda @rstoenescu last edited by

                              @rstoenescu I’m trying to emulate, but the app gets black screen. I’ll search on …

                              X 1 Reply Last reply Reply Quote 0
                              • X
                                xereda @xereda last edited by xereda

                                @xereda said in Example use cordova plugin:

                                @rstoenescu I’m trying to emulate, but the app gets black screen. I’ll search on …

                                http://g.recordit.co/WqxmooIgoH.gif

                                rstoenescu 1 Reply Last reply Reply Quote 0
                                • rstoenescu
                                  rstoenescu Admin @xereda last edited by rstoenescu

                                  @xereda huh? Where did this come from? I don’t think we are on the same page… I’ll show you tomorrow

                                  1 Reply Last reply Reply Quote 0
                                  • O
                                    obonyojimmy @rstoenescu last edited by

                                    @rstoenescu from your example you are accessing cordova plugins via cordova object , why ? if we were to eslint this will bring errors cordova not found ? right ? and in above example of camera plugin then from cordova docs CAMERA object will be undefined , yes ? so how would we solve this please ?

                                    rstoenescu 1 Reply Last reply Reply Quote 0
                                    • rstoenescu
                                      rstoenescu Admin @obonyojimmy last edited by

                                      @obonyojimmy

                                      1. Accessing cordova plugins through cordova because this is how they are supposed to work. Has nothing to do with Quasar, but with cordova-lib.
                                      2. Eslint rules (from .eslintrc.js file) has cordova specified as exception so it won’t signal any errors.
                                      3. You say “if we were to eslint”… Please do lint your code! It makes it all better and you can capture some errors at compile time 😉
                                      4. Regarding Camera --> good question. Ask cordova owners (or camera plugin owner) a question about this.

                                      Cheers,
                                      Razvan

                                      1 Reply Last reply Reply Quote 0
                                      • G
                                        gijan last edited by

                                        cordova-plugin-datecs-printer-qr
                                        cordova plugin add cordova-plugin-datecs-printer-qr
                                        not working help me. example quasar-play qr not worked fixed config options ???

                                        1 Reply Last reply Reply Quote 0
                                        • G
                                          gijan last edited by

                                          cordova-plugin-datecs-printer-qr

                                          quasar play to quasar build, cordova run android not worked cordova plugin
                                          help me plugin, config or options ???

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