npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

nfc-capacitor-java-1.8

v1.0.0

Published

Capacitor NFC Plugin for reading NDEF data from app.meishicards.com - Built with Java 1.8 compatibility

Readme

nfc-capacitor-java-1.8

Capacitor NFC Plugin for reading NDEF data specifically configured for app.meishicards.com/marketplace URIs.

⚙️ Java Compatibility

This plugin is built with Java 1.8 (Java 8) compatibility:

  • sourceCompatibility JavaVersion.VERSION_1_8
  • targetCompatibility JavaVersion.VERSION_1_8

Ensure your Android project is configured to support Java 8 or higher.

📦 Installation

npm install nfc-capacitor-java-1.8
npx cap sync

🔧 Android Configuration

Add the following permissions and configurations to your android/app/src/main/AndroidManifest.xml:

<!-- Required permissions -->
<uses-permission android:name="android.permission.NFC" />
<uses-feature android:name="android.hardware.nfc" android:required="true" />

<!-- Intent filter for NFC NDEF -->
<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="https"
          android:host="app.meishicards.com"
          android:pathPrefix="/marketplace" />
</intent-filter>

📱 Usage

TypeScript/JavaScript

import { NfcMeishi } from 'nfc-capacitor-java-1.8';

// Check if NFC is available
const checkNfc = async () => {
  const result = await NfcMeishi.isNfcAvailable();
  console.log('NFC available:', result.available);
};

// Start NFC listener
const startNfc = async () => {
  await NfcMeishi.startNfcListener();
  console.log('NFC Listener started');
};

// Listen for NFC data
NfcMeishi.addListener('nfcDataReceived', (data) => {
  console.log('NFC data received:', data.data);
  console.log('Timestamp:', data.timestamp);
});

// Stop listener
const stopNfc = async () => {
  await NfcMeishi.stopNfcListener();
  console.log('NFC Listener stopped');
};

React Component

import React, { useState, useEffect } from 'react';
import { NfcMeishi } from 'nfc-capacitor-java-1.8';

const NFCComponent: React.FC = () => {
  const [nfcData, setNfcData] = useState<string>('');
  const [isListening, setIsListening] = useState<boolean>(false);
  const [nfcAvailable, setNfcAvailable] = useState<boolean>(false);

  useEffect(() => {
    // Check NFC availability
    checkNfcAvailability();
    
    // Setup listener
    const listener = NfcMeishi.addListener('nfcDataReceived', (data) => {
      setNfcData(data.data);
      console.log('NFC Data received:', data.data);
    });

    return () => {
      listener.remove();
    };
  }, []);

  const checkNfcAvailability = async () => {
    const result = await NfcMeishi.isNfcAvailable();
    setNfcAvailable(result.available);
  };

  const startListening = async () => {
    if (nfcAvailable) {
      await NfcMeishi.startNfcListener();
      setIsListening(true);
    }
  };

  const stopListening = async () => {
    await NfcMeishi.stopNfcListener();
    setIsListening(false);
    setNfcData('');
  };

  return (
    <div>
      <h2>NFC Meishi Reader</h2>
      <p>NFC Available: {nfcAvailable ? 'Yes' : 'No'}</p>
      <p>Status: {isListening ? 'Listening...' : 'Stopped'}</p>
      
      <button onClick={startListening} disabled={!nfcAvailable || isListening}>
        Start NFC
      </button>
      
      <button onClick={stopListening} disabled={!isListening}>
        Stop NFC
      </button>
      
      <div>
        <h3>NFC Data:</h3>
        <p>{nfcData || 'Waiting for data...'}</p>
      </div>
    </div>
  );
};

export default NFCComponent;

📚 API

Methods

startNfcListener()

Starts the listener for NFC NDEF data.

Returns: Promise<void>

stopNfcListener()

Stops the NFC listener.

Returns: Promise<void>

isNfcAvailable()

Checks if NFC is available on the device.

Returns: Promise<{ available: boolean }>

getLastNfcData()

Gets the last NFC data read.

Returns: Promise<{ data: string | null }>

isListenerActive()

Checks if the listener is active.

Returns: Promise<{ active: boolean }>

Events

nfcDataReceived

Event emitted when NFC data is received.

Payload:

{
  data: string;
  timestamp: number;
}

✅ Requirements

  • Android 5.0+ (API 21+)
  • Java 8 (Java 1.8) or higher
  • Device with NFC enabled
  • NFC tags configured with URIs from https://app.meishicards.com/marketplace/*

⚠️ Limitations

  • Only works with HTTPS URIs from app.meishicards.com/marketplace
  • Requires physical device with NFC (does not work on emulators)
  • Only available on Android (iOS requires additional implementation)

🛠️ Development

# Install dependencies
npm install

# Build
npm run build

# Verify
npm run verify

📄 License

MIT

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📞 Support

For issues and questions, please use the GitHub Issues page.