スタート
このプラグインのインストール手順とマークダウン ガイドの全体を含むセットアップコマンドをコピーします。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-ibeacon`
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/ibeacon/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アシスタントのセットアップを使用してプラグインをインストールすることができます。次のコマンドを使用して、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.手動セットアップを使用する場合は、次のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-ibeaconbunx cap syncインポート
インポートimport { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';API の概要
API の概要というセクションstartMonitoringForRegion
「startMonitoringForRegion」というタイトルのセクション地域のビーコンを監視する。エントリ/エクィット時イベントをトリガーします。
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.startMonitoringForRegion({ identifier: 'MyBeaconRegion', uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'});stopMonitoringForRegion
「stopMonitoringForRegion」というタイトルのセクションビーコン地域の監視を停止します。
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.stopMonitoringForRegion({ identifier: 'MyBeaconRegion', uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'});startRangingBeaconsInRegion
「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'});startAdvertising
セクション「startAdvertising」iOS専用:デバイスをiBeaconとしてアドバタイズ
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.startAdvertising({ uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D', major: 1, minor: 2, identifier: 'MyBeacon'});stopAdvertising
セクション「stopAdvertising」iOS専用:デバイスをiBeaconとしてアドバタイズを停止
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.stopAdvertising();requestWhenInUseAuthorization
セクション「requestWhenInUseAuthorization」位置情報の「使用中」認可を要求(ビーコン探知/監視に必要)
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のセクションデバイス上のBluetoothの有効性を確認する。
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');}enableARMAFilter
enableARMAフィルタの有効化距離の計算に用いるARMAフィルタを有効にする (Android専用)。
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
await CapacitorIbeacon.enableARMAFilter({ enabled: true});enableBackgroundMode
バックグラウンドモードの有効化バックグラウンドのビーコン検出モードを有効または無効にする (Android専用)。 この機能は、常に位置情報の許可を求める必要があります。
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
// Enable background mode for beacon scanningawait CapacitorIbeacon.enableBackgroundMode({ enabled: true });
// Disable background modeawait CapacitorIbeacon.enableBackgroundMode({ enabled: false });setBackgroundScanPeriod
バックグラウンドスキャン周期の設定バックグラウンドでビーコンを検出する際のスキャン周期を設定する (Android専用)。 この機能は、常に位置情報の許可を求める必要があります。
import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';
// Set background scan to 10 seconds every 30 secondsawait CapacitorIbeacon.setBackgroundScanPeriod({ scanPeriod: 10000, // 10 seconds of scanning betweenScanPeriod: 30000 // 30 seconds between scans});タイプ リファレンス
タイプ リファレンスBeaconRegion
ビーコン リージョンビーコン地域の定義 (モニタリングと範囲)
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
「ビーコン広告オプション」セクションiBeacon (iOS 限定) として送信するビーコン広告オプション
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
「バックグラウンドスキャン期間オプション」セクションバックグラウンドスキャン期間の設定オプション (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
ビーコンが範囲内にあるときのイベントデータクリップボードにコピー
export interface RangingEventData { /** * Region that was ranged. */ region: BeaconRegion;
/** * Array of detected beacons. */ beacons: Beacon[];}MonitoringEventData
ビーコン地域の定義 (モニタリングと範囲)エリアに入ったり出たときのイベントデータ。
export interface MonitoringEventData { /** * Region that triggered the event. */ region: BeaconRegion;
/** * Event state: 'enter' or 'exit'. */ state: 'enter' | 'exit';}Beacon
「ビーコン」のセクションビーコン情報の検出
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.tsパブリック API がアップストリームで変更されたときは、再度同期を実行してください。
Getting Started から続けて
「Getting Started から続けて」のセクションあなたが使用している場合 スタート を計画し、API の操作を実行するダッシュボードに接続する @capgo/capacitor-ibeacon を使用 Using @capgo/capacitor-ibeacon のネイティブ機能 API の概要 API の概要の実装詳細 導入 導入の実装詳細 API のキー API キーの実装詳細 デバイス デバイスの実装詳細