JSPM

@testjg/nativescript-nfc

1.1.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q81959F
  • License Apache-2.0

Add a plugin description

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@testjg/nativescript-nfc) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @testjg/nativescript-nfc

    npm version

    Based on the great and more complete: https://github.com/EddyVerbruggen/nativescript-nfc

    Installation

    ns plugin add @testjg/nativescript-nfc

    Usage

    Make sure your AndroidManifest.xml includes the permission:

    <uses-permission android:name="android.permission.NFC"/>

    In your app code:

    import { NfcService } from '@testjg/nativescript-nfc';
    
    export class DemoNfc {
      private nfcService = new NfcService();
    
      async startListening() {
        const available = await this.nfcService.available();
        if (!available) return;
    
        const enabled = await this.nfcService.enabled();
        if (!enabled) return;
    
        this.nfcService.setOnNdefDiscoveredListener((nfcData) => console.log('Scanned', nfcData));
      }
    
      async stopListening() {
        this.nfcService.setOnNdefDiscoveredListener(null);
      }
    }

    License

    Apache License Version 2.0