컨텐츠로 바로가기

시작하기

터미널 창
bun add @capgo/capacitor-ibeacon
bunx cap sync
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

지역에 들어가거나 나갈 때 이벤트를 트리거합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.startMonitoringForRegion({
identifier: 'MyBeaconRegion',
uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

클립보드 복사

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.stopMonitoringForRegion({
identifier: 'MyBeaconRegion',
uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

startRangingBeaconsInRegion

클립보드 복사

범위 내 비콘을 시작합니다. 지속적인 거리 업데이트 제공

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.startRangingBeaconsInRegion({
identifier: 'MyBeaconRegion',
uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

stopRangingBeaconsInRegion

‘stopRangingBeaconsInRegion’ 섹션

범위 내 비콘을 중지합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.stopRangingBeaconsInRegion({
identifier: 'MyBeaconRegion',
uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

iOS 전용으로 장치의 iBeacon 광고를 시작합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.startAdvertising({
uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D',
major: 1,
minor: 2,
identifier: 'MyBeacon'
});

iOS 전용으로 장치의 iBeacon 광고를 중지합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.stopAdvertising();

requestWhenInUseAuthorization

‘requestWhenInUseAuthorization’ 섹션

Request “When In Use” 위치 권한 요청 (위치 측정/감시를 위해 필요함).

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
const { status } = await CapacitorIbeacon.requestWhenInUseAuthorization();
console.log('Authorization status:', status);

requestAlwaysAuthorization

requestAlwaysAuthorization

Request “Always” 위치 권한 요청 (배경 감시를 위해 필요함).

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
const { status } = await CapacitorIbeacon.requestAlwaysAuthorization();
console.log('Authorization status:', status);

getAuthorizationStatus

getAuthorizationStatus

현재 위치 권한 상태 가져오기.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
const { status } = await CapacitorIbeacon.getAuthorizationStatus();
console.log('Current status:', status);

isBluetoothEnabled

isBluetoothEnabled

장치의 블루투스 사용 여부 확인.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
const { enabled } = await CapacitorIbeacon.isBluetoothEnabled();
if (!enabled) {
console.log('Please enable Bluetooth');
}

isRangingAvailable

isRangingAvailable

장치에서 범위가 있는지 확인합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
const { available } = await CapacitorIbeacon.isRangingAvailable();
if (available) {
console.log('Ranging is supported');
}

거리 계산을 위해 ARMA 필터링을 활성화합니다 (안드로이드 전용).

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.enableARMAFilter({
enabled: true
});

배경 비콘 스캔 모드를 활성화하거나 비활성화합니다 (안드로이드 전용). 정확한 배경 비콘 감지를 위해 foreground 서비스를 활성화합니다. ‘항상’ 위치 권한을 요청한 후에 호출해야 합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
// Enable background mode for beacon scanning
await CapacitorIbeacon.enableBackgroundMode({ enabled: true });
// Disable background mode
await CapacitorIbeacon.enableBackgroundMode({ enabled: false });

배경 스캔 기간을 구성합니다 (안드로이드 전용). 배경에서 비콘을 스캔하는 빈도와 시간을 제어합니다.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
// Set background scan to 10 seconds every 30 seconds
await CapacitorIbeacon.setBackgroundScanPeriod({
scanPeriod: 10000, // 10 seconds of scanning
betweenScanPeriod: 30000 // 30 seconds between scans
});

비콘 지역 정의 (모니터링 및 범위)

export interface BeaconRegion {
/**
* Unique identifier for this region.
*/
identifier: string;
/**
* UUID of the beacon(s) to detect.
*/
uuid: string;
/**
* Major value for filtering (optional).
*/
major?: number;
/**
* Minor value for filtering (optional).
*/
minor?: number;
/**
* Notify when device enters region (iOS only).
*/
notifyEntryStateOnDisplay?: boolean;
/**
* Enable Android background mode for this monitoring/ranging call.
* When true, the plugin will keep scanning in background using a foreground service.
*/
enableBackgroundMode?: boolean;
}

BeaconAdvertisingOptions

BeaconAdvertisingOptions 섹션

iOS에서만 전송하는 iBeacon 비콘 광고 옵션

export interface BeaconAdvertisingOptions {
/**
* UUID to advertise.
*/
uuid: string;
/**
* Major value (0-65535).
*/
major: number;
/**
* Minor value (0-65535).
*/
minor: number;
/**
* Identifier for the advertising beacon.
*/
identifier: string;
/**
* Measured power (RSSI at 1 meter). Optional, defaults to -59.
*/
measuredPower?: number;
}

BackgroundScanPeriodOptions

BackgroundScanPeriodOptions 섹션

Android에서만 사용하는 배경 스캔 기간 설정 옵션

export interface BackgroundScanPeriodOptions {
/**
* Duration of each scan period in milliseconds.
* Default: 10000 (10 seconds)
*/
scanPeriod?: number;
/**
* Duration between scan periods in milliseconds.
* Default: 15000 (15 seconds)
*/
betweenScanPeriod?: number;
}

RangingEventData

RangingEventData 섹션

비콘을 범위할 때 발생하는 이벤트 데이터

export interface RangingEventData {
/**
* Region that was ranged.
*/
region: BeaconRegion;
/**
* Array of detected beacons.
*/
beacons: Beacon[];
}

MonitoringEventData

'MonitoringEventData' 섹션

지역에 들어가거나 나갈 때 발생하는 이벤트 데이터.

export interface MonitoringEventData {
/**
* Region that triggered the event.
*/
region: BeaconRegion;
/**
* Event state: 'enter' or 'exit'.
*/
state: 'enter' | 'exit';
}

탐지된 비콘 정보.

export interface Beacon {
/**
* Beacon UUID.
*/
uuid: string;
/**
* Major value.
*/
major: number;
/**
* Minor value.
*/
minor: number;
/**
* RSSI (Received Signal Strength Indicator).
*/
rssi: number;
/**
* Proximity: 'immediate', 'near', 'far', or 'unknown'.
*/
proximity: 'immediate' | 'near' | 'far' | 'unknown';
/**
* Estimated distance in meters.
*/
accuracy: number;
}

진실의 근원

'Source Of Truth' 섹션

이 페이지는 플러그인의 src/definitions.ts. upstream에서 변경된 API의 공개 버전을 다시 동기화할 때입니다.