Skip to main content
@capgo/capacitor-ibeacon Location Open source

iBeacon Capacitor plugin

iBeacon plugin for Capacitor - proximity detection and beacon region monitoring

Install

bun add @capgo/capacitor-ibeacon bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-ibeacon
  • pnpm add @capgo/capacitor-ibeacon
  • yarn add @capgo/capacitor-ibeacon

Guide

How to use iBeacon in Capacitor

Using @capgo/capacitor-ibeacon

Capacitor iBeacon Plugin - Proximity detection and beacon region monitoring.

Install

bun add @capgo/capacitor-ibeacon
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

API at a glance

Method Description
startMonitoringForRegion Start monitoring for a beacon region. Triggers events when entering/exiting the region.
stopMonitoringForRegion Stop monitoring for a beacon region.
startRangingBeaconsInRegion Start ranging beacons in a region. Provides continuous distance updates.
stopRangingBeaconsInRegion Stop ranging beacons in a region.
startAdvertising Start advertising the device as an iBeacon (iOS only).
stopAdvertising Stop advertising the device as an iBeacon (iOS only).
requestWhenInUseAuthorization Request "When In Use" location authorization (required for ranging/monitoring).
requestAlwaysAuthorization Request "Always" location authorization (required for background monitoring).
getAuthorizationStatus Get current location authorization status.
isBluetoothEnabled Check if Bluetooth is enabled on the device.
isRangingAvailable Check if ranging is available on the device.
enableARMAFilter Enable ARMA filtering for distance calculations (Android only).
enableBackgroundMode Enable or disable background beacon scanning mode (Android only). This enables a foreground service for reliable background beacon detection. Must be called after requesting "Always" location authorization.
setBackgroundScanPeriod Configure background scan periods (Android only). Controls how often and how long the device scans for beacons when in background.

Examples

startMonitoringForRegion()

Start monitoring for a beacon region. Triggers events when entering/exiting the region.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

await CapacitorIbeacon.startMonitoringForRegion({
  identifier: 'MyBeaconRegion',
  uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

stopMonitoringForRegion()

Stop monitoring for a beacon region.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

await CapacitorIbeacon.stopMonitoringForRegion({
  identifier: 'MyBeaconRegion',
  uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

startRangingBeaconsInRegion()

Start ranging beacons in a region. Provides continuous distance updates.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

await CapacitorIbeacon.startRangingBeaconsInRegion({
  identifier: 'MyBeaconRegion',
  uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

stopRangingBeaconsInRegion()

Stop ranging beacons in a region.

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

await CapacitorIbeacon.stopRangingBeaconsInRegion({
  identifier: 'MyBeaconRegion',
  uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D'
});

startAdvertising()

Start advertising the device as an iBeacon (iOS only).

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

await CapacitorIbeacon.startAdvertising({
  uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D',
  major: 1,
  minor: 2,
  identifier: 'MyBeacon'
});

stopAdvertising()

Stop advertising the device as an iBeacon (iOS only).

import { CapacitorIbeacon } from '@capgo/capacitor-ibeacon';

await CapacitorIbeacon.stopAdvertising();

The table above lists the 14 core methods. Listener and version helpers, and the full contract of each method, are documented in the GitHub repository.

Listen to events

addListener returns a handle. Call handle.remove() when the screen unmounts, or CapacitorIbeacon.removeAllListeners() to clear every listener.

Full reference

Keep going from Using @capgo/capacitor-ibeacon

If you are using Using @capgo/capacitor-ibeacon to plan native plugin work, connect it with @capgo/capacitor-ibeacon for the implementation detail in @capgo/capacitor-ibeacon, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

iBeacon plugin FAQ

How do I install the iBeacon plugin in a Capacitor app?

Run "bun add @capgo/capacitor-ibeacon" (or "npm install @capgo/capacitor-ibeacon"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-ibeacon" in your app code.

Does @capgo/capacitor-ibeacon work with React, Vue and Angular?

Yes. iBeacon is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-ibeacon support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-ibeacon free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-ibeacon/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses iBeacon without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship iBeacon changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo