Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

358
Vistas
I am using the library phonegap-nfc to scan nfc but when I scan it opens other page

I'm using phonegap-nfc library in my vue project. Its working but I don't know why it open the information I have on my NFC car in other page information. What I want to do is show all the information that NFC have in my app. So if anyone knows how to do it could you help me please?

Here is my code:

<template>
  <v-app>
    <v-card-actions>
      <div class="cardInfos">
        {{ tagId }}
        {{ message }}
      </div>
    </v-card-actions>
  </v-app>
</template>

<script>
export default {
  name: 'App',

  data: () => ({
    tagId: "",
    message: ""
  }),

  methods:{
    scanNFC(){
      window.nfc.enabled(
        () => {
          // NFC enabled
          this.registerTagEvent()
        },
        (error) => {
          if (error === 'NFC_DISABLED') {
            // Trigger the phone settings to enable the NFC settings
            window.nfc.showSettings()
          } else if (error === 'NO_NFC') {
            navigator.notification.alert('Cannot scan NFC', () => {}, 'No NFC', 'OK')
          }
        }
      )
    },

    registerTagEvent () {
      window.nfc.addTagDiscoveredListener(
        this.displayNdef,
        () => {
          console.log('succeess registering ndef listener')
        },
        (error) => {
          console.log('failure registering ndef listener', error)
        }
      )
    },

    displayNdef (nfcEvent) {
      // Decode tag data from the plugin
        const bgColor = document.getElementsByClassName(".v-application--wrap")
        bgColor.style.backgroudColor = "green"
        let tag = nfcEvent.tag
        let tagId = window.nfc.bytesToHexString(tag.id)
        let message = window.nfc.bytesToString(tag.ndefMessage[0].payload)
        this.tagId = tagId
        this.message = message

        window.ndefMessage(tagId, message)
      }
    },

    deactivated () {
      this.unregisterTagEvent()
    },

    unregisterTagEvent () {
      // Test if the plugin is defined
      if ((typeof nfc) !== 'undefined') {
        window.nfc.removeNdefListener(this.displayNdef)
      }
    },
};
</script>

Can anyone help me please :)

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I solved the problem with these steps:

Steps to disable Tags app on stock Android:

Navigate to Settings Click on Apps & Notifications Click on See all apps (Usually under Recently opened apps) Click on 3 dots on top right hand Click on Show system (which will enable all system installed apps) Search for the app (default nfc app, which you will see in Choose options while reading NFC tag) Usually the app is called Tags: click on Tags app in the list of apps Click on Disable and click on OK on any dialogs which are displayed around disabling the app

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda