Skip to main content
@capgo/capacitor-uwb Device APIs Open source

UWB Capacitor plugin

Ultra-Wideband ranging for peer distance and direction on iOS Nearby Interaction and Android Jetpack UWB

Install

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

Guide

How to use UWB in Capacitor

Using @capgo/capacitor-uwb

Capacitor plugin for Ultra-Wideband (UWB) ranging on iOS and Android.

Install

bun add @capgo/capacitor-uwb
bunx cap sync

What This Plugin Exposes

  • isAvailable - Check whether UWB is supported and currently available.
  • getDiscoveryToken - Get the local Nearby Interaction discovery token on iOS.
  • startPeerSession - Start an iOS peer ranging session.
  • startControllerSession - Start an Android controller session and return shareable parameters.
  • startControleeSession - Start an Android controlee session from controller parameters.
  • stopSession - Stop the active ranging session.

Example Usage

Check availability

import { CapacitorUwb } from '@capgo/capacitor-uwb';

const availability = await CapacitorUwb.isAvailable();

iOS peer ranging

const { discoveryToken } = await CapacitorUwb.getDiscoveryToken();

await CapacitorUwb.startPeerSession({
  peerDiscoveryToken: '<peer-token-base64>',
});

Android controller / controlee

const controller = await CapacitorUwb.startControllerSession();

await CapacitorUwb.startControleeSession({
  rangingParameters: controller.rangingParameters,
});

Full Reference

Keep going from Using @capgo/capacitor-uwb

If you are using Using @capgo/capacitor-uwb to plan native plugin work, connect it with @capgo/capacitor-uwb for the implementation detail in @capgo/capacitor-uwb, 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

UWB plugin FAQ

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

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

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

Yes. UWB 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-uwb 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-uwb free and open source?

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

Can I update code that uses UWB 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 UWB 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