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

    Exit app in android (solved)

    Help
    2
    9
    752
    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.
    • jpsala
      jpsala last edited by jpsala

      Hello, I’m trying to exit my app this way:
      can you tell me what’s wrong?
      When the user press a button I run this action and the code in the else block is executed 😞

      logout({ commit, dispatch }) {
          if (navigator.app) {
            navigator.app.exitApp();
          } else if (navigator.device) {
            navigator.device.exitApp();
          } else {
            commit('API_TOKEN', undefined);
            dispatch('setLoginData', undefined);
            dispatch('setHijoActivo', undefined);
            window.close();
          }
        },
      
      metalsadman 1 Reply Last reply Reply Quote 0
      • metalsadman
        metalsadman @jpsala last edited by

        @jpsala you probably don’t have navigator available from where you called that logout action of yours.

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

          @metalsadman, do you have some advice? how is that navigator is not available? maybe because I’m not in a .vue file? did you have to exit from an android app?

          metalsadman 1 Reply Last reply Reply Quote 0
          • jpsala
            jpsala last edited by

            it works find in the emulator but not from the actual device once installed

            1 Reply Last reply Reply Quote 0
            • metalsadman
              metalsadman @jpsala last edited by metalsadman

              @jpsala yep, i guess that resides in your action something js. try using mapActions in your vue into that file, see if it gets navigator context, otherwise you’ll have to transfer that logic in your view. or you could pass the navigator itself as payload to your action.
              ie.

              // in your vue file
              this.$store.dispatch('logout', navigator)
              // in your action
              logout({ commit, dispatch }, navigator) {
              ...
              
              1 Reply Last reply Reply Quote 0
              • jpsala
                jpsala last edited by

                it’s strange that it’s working in the emulator but you are right, I’ll try to refactor so to use the navigator object after returning from the action, or something like that

                metalsadman 1 Reply Last reply Reply Quote 0
                • metalsadman
                  metalsadman @jpsala last edited by

                  @jpsala said in Exit app in android:

                  it’s strange that it’s working in the emulator but you are right, I’ll try to refactor so to use the navigator object after returning from the action, or something like that

                  see update above.

                  1 Reply Last reply Reply Quote 1
                  • jpsala
                    jpsala last edited by

                    mmm, nice one 🙂 easier that what I was going to do, I’ll try that, thanks man!

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

                      @metalsadman, it worked!!! I suppose it worked outside a .vue because of the window.close(), sending navigator as a param to the action worked like a charm, thanks again!

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