Skip to main content

cordova-plugin-ibeacon Alternative for Capacitor

cordova-plugin-ibeacon alternative for Capacitor: monitor regions, range beacons and advertise on iOS with @capgo/capacitor-ibeacon and Capacitor listeners.

Illustration of migrating a Cordova app to Capacitor, used for an iBeacon plugin guide

The practical cordova-plugin-ibeacon alternative for a Capacitor app is @capgo/capacitor-ibeacon. It covers the same proximity workflows as cordova-plugin-ibeacon (region monitoring, ranging, and iOS advertising) with promise-based calls and Capacitor event listeners instead of cordova.plugins.locationManager and delegate callbacks. This guide lists verifiable maintenance facts, install steps, a usage sample, and an API map for your Cordova to Capacitor move.

Why leave cordova-plugin-ibeacon in Capacitor

The Cordova plugin is published on npm as cordova-plugin-ibeacon version 3.8.1. The registry modified timestamp is 14 June 2022, and the latest version line in that package is 3.8.1 from 12 May 2019. The upstream source lives at petermetz/cordova-plugin-ibeacon, which documents a LocationManager facade modeled on Apple’s CLLocationManager.

In a Capacitor codebase you still carry Cordova-only baggage:

  • Installation through cordova plugin add and the cordova.plugins.locationManager namespace.
  • BeaconRegion objects built in JavaScript with prototype helpers from the Cordova plugin.
  • Delegate events wired through setDelegate rather than Capacitor addListener.

@capgo/capacitor-ibeacon targets Capacitor 8 with an actively maintained v8 release line per the README compatibility table. Capgo ships issue fixes on an open source cadence where a human still reviews, tests and merges 50+ pull requests daily. The plugin documents iOS background modes, Android foreground service options for background scanning on Android 8+, and ARMA filtering helpers that the Cordova README does not cover for modern Android.

Install

bun add @capgo/capacitor-ibeacon
bunx cap sync

iOS: add NSLocationWhenInUseUsageDescription, NSLocationAlwaysAndWhenInUseUsageDescription, NSBluetoothAlwaysUsageDescription, and the UIBackgroundModes entries from the plugin README. Enable Background Modes capability for location updates and Bluetooth LE accessories in Xcode when you need background monitoring.

Android: the README documents background scanning through enableBackgroundMode() and optional setBackgroundScanPeriod(). Sync native projects after changing Capacitor config.

Usage example

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

const region = {
  identifier: 'StoreFloor',
  uuid: 'B9407F30-F5F8-466E-AFF9-25556B57FE6D',
  major: 1,
};

export async function watchStore() {
  await CapacitorIbeacon.requestWhenInUseAuthorization();

  await CapacitorIbeacon.addListener('didEnterRegion', (data) => {
    console.log('Entered', data.region.identifier);
  });

  await CapacitorIbeacon.startMonitoringForRegion(region);
  await CapacitorIbeacon.startRangingBeaconsInRegion(region);
}

Migrating from Cordova to Capacitor

Replace cordova.plugins.locationManager with CapacitorIbeacon. Pass plain region objects instead of new BeaconRegion(...), and subscribe with addListener for events that used to hit your delegate.

API mapping table

cordova-plugin-ibeacon (LocationManager) @capgo/capacitor-ibeacon
new cordova.plugins.locationManager.BeaconRegion(id, uuid, major, minor) { identifier, uuid, major?, minor? } object
startMonitoringForRegion(region) startMonitoringForRegion(options)
stopMonitoringForRegion(region) stopMonitoringForRegion(options)
startRangingBeaconsInRegion(region) startRangingBeaconsInRegion(options)
stopRangingBeaconsInRegion(region) stopRangingBeaconsInRegion(options)
requestWhenInUseAuthorization() requestWhenInUseAuthorization()
requestAlwaysAuthorization() requestAlwaysAuthorization()
getAuthorizationStatus() getAuthorizationStatus()
startAdvertising(region, measuredPower) startAdvertising(options)
stopAdvertising() stopAdvertising()
isRangingAvailable() isRangingAvailable()
isBluetoothEnabled() isBluetoothEnabled()
Delegate didEnterRegion addListener('didEnterRegion', ...)
Delegate didExitRegion addListener('didExitRegion', ...)
Delegate didRangeBeaconsInRegion addListener('didRangeBeacons', ...)
Delegate didDetermineStateForRegion addListener('didDetermineStateForRegion', ...)

Capgo adds Android-only tuning such as enableARMAFilter() and enableBackgroundMode() that have no direct equivalent in the Cordova plugin README. Map those when you port background venue analytics.

Native permission or background mode changes need a store build. Use Capgo Build for cloud binaries, then ship UX updates with Capgo live updates. See the Cordova to Capacitor migration guide for the full platform move.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.