NFC __CAPGO_KEEP_0__ 저장소
설치 명령어와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 프롬프트 복사
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-nfc`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/nfc/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치 섹션AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. AI 도구에 Capgo 기능을 추가하려면 다음 명령어를 사용하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins그런 다음 다음 명령어를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-nfc` plugin in my project.만약 Manual Setup을 선호한다면, 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-nfcbunx cap syncImport
__CAPGO_KEEP_0__ 개요import { CapacitorNfc } from '@capgo/capacitor-nfc';API 개요
API 개요startScanning
NFC 태그를 감지하기 위해 듣기 시작합니다.설치 명령어
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.startScanning();stopScanning
스캔 중지스캔 중인 NFC 세션을 중지합니다.
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.stopScanning();write
쓰기지난에 발견된 태그에 제공된 NDEF 레코드를 쓰습니다.
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.write({ records: [ { tnf: 1, type: [1], id: [1], payload: [1], }, ],});erase
지우기지난에 발견된 태그를 비어있는 NDEF 메시지를 쓰어 삭제하려고 시도합니다.
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.erase();makeReadOnly
읽기 전용으로 만들기지난에 발견된 태그를 읽기 전용으로 만들려고 시도합니다.
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.makeReadOnly();share
제목 '공유'다른 기기와 NFC로 데이터를 공유합니다 (안드로이드 전용).
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.share({ records: [ { tnf: 1, type: [1], id: [1], payload: [1], }, ],});unshare
제목 '공유 중지'이전으로 공유된 NDEF 메시지를 중지합니다 (안드로이드 전용).
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.unshare();getStatus
제목 'getStatus'현재 NFC 어댑터 상태를 반환합니다.
import { CapacitorNfc } from '@capgo/capacitor-nfc';
const result = await CapacitorNfc.getStatus();console.log(result);showSettings
제목 '설정 열기'시스템 설정 페이지를 열어 NFC를 활성화할 수 있습니다.
import { CapacitorNfc } from '@capgo/capacitor-nfc';
await CapacitorNfc.showSettings();isSupported
isSupported장치가 NFC 하드웨어 지원을 가지고 있는지 확인합니다.
반환 true 장치에 NFC 하드웨어가 있는 경우, NFC가 현재 활성화되거나 비활성화되어도 무관합니다. 반환 false 장치에 NFC 하드웨어가 없는 경우
이 메서드를 사용하여 NFC 기능이 앱의 UI에서 표시되어야 하는지 결정하세요. NFC가 현재 활성화되어 있는지 확인하려면 getStatus().
import { CapacitorNfc } from '@capgo/capacitor-nfc';
const result = await CapacitorNfc.isSupported();console.log(result);타입 참조
타입 참조StartScanningOptions
스캔 시작 옵션스캔 시작 옵션
export interface StartScanningOptions { /** * iOS-only: closes the NFC session automatically after the first successful tag read. * Defaults to `true`. */ invalidateAfterFirstRead?: boolean; /** * iOS-only: custom message displayed in the NFC system sheet while scanning. */ alertMessage?: string; /** * iOS-only: session type to use for NFC scanning. * - `'ndef'`: Uses NFCNDEFReaderSession (default). Only detects NDEF-formatted tags. * - `'tag'`: Uses NFCTagReaderSession. Detects both NDEF and non-NDEF tags (e.g., raw MIFARE tags). * Allows reading UID from unformatted tags. * **Requires** the `Near Field Communication Tag Reader Session Formats` entitlement * in your app with the `TAG` format included. Without it the session will fail to * start and the promise will reject with a `NO_NFC` error code. * Defaults to `'ndef'` for backward compatibility. */ iosSessionType?: 'ndef' | 'tag'; /** * Android-only: raw flags passed to `NfcAdapter.enableReaderMode`. * Defaults to enabling all tag types with skipping NDEF checks. */ androidReaderModeFlags?: number;}WriteTagOptions
WriteTagOptions 섹션현재 태그에 NDEF 메시지를 쓰기 위한 사용되는 옵션입니다.
export interface WriteTagOptions { /** * Array of records that compose the NDEF message to be written. */ records: NdefRecord[]; /** * When `true`, the plugin attempts to format NDEF-formattable tags before writing. * Defaults to `true`. */ allowFormat?: boolean;}ShareTagOptions
ShareTagOptions 섹션Android Beam / P2P 모드에서 다른 장치와 NDEF 메시지를 공유할 때 사용되는 옵션입니다.
export interface ShareTagOptions { records: NdefRecord[];}NfcStatus
NfcStatus 섹션NFC 어댑터의 상태입니다.
export type NfcStatus = 'NFC_OK' | 'NO_NFC' | 'NFC_DISABLED' | 'NDEF_PUSH_DISABLED';NfcEvent
NfcEvent 섹션플러그인이 디스패치하는 일반적인 NFC 발견 이벤트입니다.
export interface NfcEvent { type: NfcEventType; tag: NfcTag;}NfcStateChangeEvent
NfcStateChangeEvent 제목NFC 어댑터 가용성 변경 시 발생하는 이벤트입니다.
export interface NfcStateChangeEvent { status: NfcStatus; enabled: boolean;}NdefRecord
NdefRecord 제목단일 NDEF 레코드를 나타내는 JSON 구조입니다.
export interface NdefRecord { /** * Type Name Format identifier. */ tnf: number; /** * Type field expressed as an array of byte values. */ type: number[]; /** * Record identifier expressed as an array of byte values. */ id: number[]; /** * Raw payload expressed as an array of byte values. */ payload: number[];}NfcEventType
NfcEventType 제목발생한 NFC 발견 유형을 설명하는 이벤트 유형입니다.
export type NfcEventType = 'tag' | 'ndef' | 'ndef-mime' | 'ndef-formatable';NfcTag
NfcTag 제목자연어 층에서 반환한 전체 태그 정보를 나타내는 표현입니다.
export interface NfcTag { /** * Raw identifier bytes for the tag. */ id?: number[]; /** * List of Android tech strings (e.g. `android.nfc.tech.Ndef`). */ techTypes?: string[]; /** * Human readable tag type when available (e.g. `NFC Forum Type 2`, `MIFARE Ultralight`). */ type?: string | null; /** * Maximum writable size in bytes for tags that expose NDEF information. */ maxSize?: number | null; /** * Indicates whether the tag can be written to. */ isWritable?: boolean | null; /** * Indicates whether the tag can be permanently locked. */ canMakeReadOnly?: boolean | null; /** * Array of NDEF records discovered on the tag. */ ndefMessage?: NdefRecord[] | null;}실질적인 진실
실질적인 진실 섹션이 페이지는 플러그인의 src/definitions.ts 다시 싱크를 실행할 때 공개 API upstream에서 변경되면.
Getting Started에서 계속
Getting Started에서 계속Getting Started을 사용하여 대시보드와 __CAPGO_KEEP_0__를 계획하고 Using @API/__CAPGO_KEEP_1__-nfc Capgo 사용자 가이드 Using @capgo/capacitor-nfc Using @capgo/capacitor-nfc API 개요 API 구현 세부 사항에 대한 설명 소개 __CAPGO_KEEP_0__ 구현 세부 사항에 대한 설명 API 키 API 키 구현 세부 사항에 대한 설명, 및 장치 __CAPGO_KEEP_0__ 구현 세부 사항에 대한 설명