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

    Use cordova SMS plugin correctly

    Help
    1
    2
    352
    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.
    • djcaesar9114
      djcaesar9114 last edited by

      Hello everyone,
      I’m trying to use this plugin: https://github.com/floatinghotpot/cordova-plugin-sms#readme
      I added the plugin using

      cordova plugin add cordova-plugin-sms
      

      And updated my Formulaire.vue like this:

      <template>
        <q-page padding>
          <p>
            FORMULAIRE
          </p>
          <q-btn
            color="primary"
            icon="question_answer"
            label="Vérifier en central"
            @click="sendSMS ()" />
        </q-page>
      </template>
      
      <script>
      export default {
        name: 'Formulaire',
        data () {
          return {
            SMStext: 'TEST SMS'
          }
        },
        methods: {
          initApp () {
            if (!SMS) {
              alert('SMS plugin not ready')
            }
          },
          sendSMS () {
            var sendto = '+123456'
            var textmsg = 'TEST'
            if (sendto.indexOf(';') >= 0) {
              sendto = sendto.split(';')
              for (var i in sendto) {
                sendto[i] = sendto[i].trim()
              }
            }
            if (SMS) {
              SMS.sendSMS (sendto, textmsg, function () { }, function (str) { alert (str) })
            }
          }
        },
        created () {
          if ((/(ipad|iphone|ipod|android)/i.test (navigator.userAgent))) {
            window.addEventListener ('deviceready', this.initApp, false)
          } else {
            // updateStatus ('need run on mobile device for full functionalities.')
          }
        }
      }
      </script>
      

      But when I run

      quasar dev -m cordova -T android
      

      I have this error:

      /home/cesar/projets/quasar/client_sms_referendum/src/pages/Formulaire.vue
        24:12  error  'SMS' is not defined  no-undef
        37:11  error  'SMS' is not defined  no-undef
        38:9   error  'SMS' is not defined  no-undef
      

      I know I didn’t defined ‘SMS’ but I checked the example given on github and I really don’t see how I can solve it…
      Thanks for your help 🙂

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

        I managed to buldi my apk after editing my .eslintrc.js file:

        'no-undef': 'off'
        

        But I think it’s not the correct way to do it.

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