내용으로 건너뛰기

시작하기

GitHub

Capgo의 AI 보조 설치를 사용하여 플러그인을 설치할 수 있습니다. 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-ibeacon` plugin in my project.

만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래에 플랫폼에 따라 설명된 지침을 따르세요.

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

__CAPGO_KEEP_0__ 제목 "startMonitoringForRegion"

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

__CAPGO_KEEP_0__ 제목 "startRangingBeaconsInRegion"

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

__CAPGO_KEEP_0__ 제목 "startRangingBeaconsInRegion"

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

stopRangingBeaconsInRegion

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

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

startAdvertising

__CAPGO_KEEP_0__

__CAPGO_KEEP_3__

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

stopAdvertising

__CAPGO_KEEP_0__

__CAPGO_KEEP_5__

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

requestWhenInUseAuthorization

__CAPGO_KEEP_0__

__CAPGO_KEEP_7__

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

requestAlwaysAuthorization

requestAlwaysAuthorization

백그라운드 모니터링을 위해 항상 위치 권한 요청

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');
}

거리 계산을 위해 Android에서만 ARMA 필터링을 활성화합니다.

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

enableBackgroundMode

배경 모드 활성화

Android에서만 배경 비콘 스캔 모드를 활성화하거나 비활성화합니다. 이 모드는 항상 위치 권한을 요청한 후에 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 });

setBackgroundScanPeriod

배경 스캔 주기 설정

Android에서만 배경 스캔 주기를 설정합니다. 배경에서 비콘을 스캔하는 빈도와 시간을 제어합니다.

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
});

타입 참조

타입 참조

BeaconRegion

비콘 지역

__CAPGO_KEEP_0__ definitions for monitoring and ranging.

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;
}

iOS에서만 전송하는 iBeacon으로 광고 전송을 위한 __CAPGO_KEEP_1__.

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;
}

__CAPGO_KEEP_3__ 기간 설정 옵션 (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;
}

__CAPGO_KEEP_4__ 시에 발생하는 이벤트 데이터.

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

__CAPGO_KEEP_0__ 변경 시 이벤트 데이터.

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;
}

이 페이지는 플러그인의 src/definitions.tsAPI이 업스트림에서 변경될 때마다 다시 싱크를 실행하세요.

Getting Started에서 계속

"Getting Started에서 계속" 섹션

__CAPGO_KEEP_0__이 업스트림에서 변경될 때마다 다시 싱크를 실행하세요. 사용 중입니다. Getting Started API을 위한 대시보드와 API 운영을 계획하고 연결하는 Using @capgo/capacitor-ibeacon Using @capgo/capacitor-ibeacon에서 native 기능을 사용하기 위해 API Overview API Overview에서 구현 세부 정보를 참조하세요. Introduction Introduction에서 구현 세부 정보를 참조하세요. API Keys API Keys에서 구현 세부 정보를 참조하세요. Devices Devices에서 구현 세부 정보를 참조하세요.