/shiny:shiny-beaconsfrom shiny
iBeacon and Eddystone ranging, background region monitoring, and broadcasting for .NET MAUI, iOS, Android, macOS, Windows, Linux and Blazor using Shiny.Beacons
Ships in shiny. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
iBeacon and Eddystone ranging, background region monitoring, and broadcasting.
Use this skill when the user needs to:
| Property | Value |
|---|---|
| NuGet | Shiny.Beacons |
| Namespace | Shiny.Beacons |
| Platforms | iOS, Mac Catalyst, macOS, Android, Windows, Linux, Blazor WebAssembly. No tvOS target — tvOS binds no CLBeacon* type at all |
| DI Namespace | Shiny (extension methods on IServiceCollection) |
| Depends on | Shiny.BluetoothLE, Shiny.BluetoothLE.Hosting |
iBeacon and Eddystone travel through different parts of a BLE advertisement, and that dictates everything else.
0x004C. CoreBluetooth strips it
from every scan result on iOS, Mac Catalyst and macOS. There is no scan configuration that gets it
back. So on Apple platforms iBeacon goes through CoreLocation and costs a location
permission. Everywhere else Shiny parses the advertisement directly and it costs a Bluetooth
permission.0xFEAA, which CoreBluetooth passes through untouched.
It behaves identically on every platform, Apple included.Never tell a user that an iOS app can range iBeacons over IBleManager.Scan(). It cannot.
// Foreground ranging - "which beacons are near me and how far?"
services.AddBeaconRanging();
// Background region monitoring - "tell me when I enter/leave"
services.AddBeaconMonitoring<MyBeaconMonitorDelegate>();
// Eddystone frames (works everywhere, including Apple)
services.AddEddystoneScanning();
// Become a beacon
services.AddBeaconBroadcasting();
All four accept an optional BeaconRangingOptions. AddBeaconMonitoring also wires the default
repository so regions survive a process restart.
On Linux or any plain-.NET host, register a IBleManager first (AddBluetoothLE() from
Shiny.BluetoothLE.Linux) — the beacon registrations throw a named error if none is present.
public class BeaconViewModel(IBeaconRangingManager ranging)
{
IDisposable? sub;
public async Task Start()
{
var access = await ranging.RequestAccess();
if (access != AccessState.Available)
return;
var region = new BeaconRegion("store-front", Guid.Parse("B9407F30-F5F8-466E-AFF9-25556B57FE6D"));
this.sub = ranging
.WhenBeaconRanged(region)
.Subscribe(beacon =>
{
// beacon.Distance is metres, beacon.Proximity is the bucket
Console.WriteLine($"{beacon.Major}/{beacon.Minor}: {beacon.Distance:N1}m ({beacon.Proximity})");
});
}
public void Stop() => this.sub?.Dispose();
}
Ranging starts on first subscription and stops when the last subscription is disposed. It is a foreground activity — use monitoring for anything that has to work with the app closed.
WhenBeaconRanged emits once per advertisement, which is far too chatty to bind a list to. Use the
managed scan, which keeps one entry per beacon and updates it in place:
var scan = ranging.CreateManagedScan();
await scan.Start(region, scheduler, clearTime: TimeSpan.FromSeconds(15));
// scan.Beacons is an INotifyReadOnlyCollection<ManagedBeacon>
clearTime drops beacons that stop advertising, so the list reflects what is actually in range.
public class MyBeaconMonitorDelegate(INotificationManager notifications) : IBeaconMonitorDelegate
{
public Task OnStatusChanged(BeaconRegionState newStatus, BeaconRegion region)
=> notifications.Send("Beacons", $"{region.Identifier}: {newStatus}");
}
// somewhere in your app
var access = await monitoring.RequestAccess(); // asks for ALWAYS location on Apple
if (access == AccessState.Available)
await monitoring.StartMonitoring(new BeaconRegion("store-front", uuid, major: 1));
Monitored regions are persisted and re-armed on the next launch. Monitoring reports only entry/exit — it never reports distance. Range the region in the foreground when you need that.
var access = await scanner.RequestAccess();
scanner.WhenFrameReceived().Subscribe(frame =>
{
switch (frame)
{
case EddystoneUidFrame uid:
Console.WriteLine($"{uid.Uid.Namespace}/{uid.Uid.Instance} at {uid.Distance:N1}m");
break;
case EddystoneUrlFrame url:
Console.WriteLine(url.Url);
break;
case EddystoneTlmFrame { IsEncrypted: false } tlm:
// BatteryVolts is null on a mains-powered beacon, TemperatureCelsius null with no sensor
Console.WriteLine($"{tlm.BatteryVolts}V {tlm.TemperatureCelsius}C up {tlm.Uptime}");
break;
}
});
Correlate a TLM frame with the beacon's UID/URL frame using frame.PeripheralId — a beacon
interleaves frame types, and only the peripheral identifier ties them together.
EID frames surface their raw rotating identifier as EddystoneEidFrame.EphemeralId. Resolving one
back to a registered beacon needs the deployment's identity key and the Curve25519/AES-EAX
derivation from the spec, which this library does not implement.
await broadcaster.StartIBeacon(uuid, major: 1, minor: 2);
await broadcaster.StartEddystoneUid(EddystoneUid.Parse("0102030405060708090A", "0B0C0D0E0F10"));
await broadcaster.StartEddystoneUrl("https://shinylib.net/");
broadcaster.Stop();
Only one advertisement runs at a time; starting a second replaces the first.
RequestAccess() and check the AccessState before ranging, monitoring or broadcasting.IBeaconRangingManager, IBeaconMonitoringManager, IEddystoneScanner,
IBeaconBroadcaster) — never instantiate them.BeaconRegion requires a unique Identifier and a UUID. Major is optional; Minor requires
Major. 0 is a legal value for both — do not treat it as "unset".IBeaconMonitorDelegate for background transitions, never a subscription. The app may not
be running when the transition fires.ManagedBeaconScan, not through raw WhenBeaconRanged output.Beacon.Distance over Beacon.Rssi in user-facing code. Rssi is the raw single-packet
reading and is very noisy; Distance is computed from filtered signal.Beacon.TxPower is null on Apple platforms. CoreLocation never surfaces the raw advertisement.
Do not write code that requires it cross-platform.Beacon records for identity — every observation differs in RSSI and timestamp.
Use Beacon.Identity (a BeaconIdentity of UUID/major/minor).IBeaconPacket (in Shiny.BluetoothLE) to read or build a raw iBeacon payload. Never
hand-roll it with Guid.ToByteArray() or BitConverter.GetBytes() — both are little-endian and
iBeacon is big-endian throughout.Everything lives on BeaconRangingOptions, passed to the Add* call:
services.AddBeaconRanging(new BeaconRangingOptions
{
// cluttered indoor space attenuates faster than free space (2.0)
DistanceEstimator = new PathLossDistanceEstimator(3.0),
// shorter window reacts faster to movement; longer reads more steadily when stationary
RssiFilterWindow = TimeSpan.FromSeconds(10),
// when a beacon advertises no calibration value
DefaultTxPower = -59,
ImmediateThreshold = 0.5,
NearThreshold = 3.0,
RegionExitTimeout = TimeSpan.FromSeconds(30)
});
PathLossDistanceEstimator (default) — d = 10^((txPower - rssi) / (10n)). Hardware-neutral
and predictable. Raise n towards 3-4 indoors.CurveFitDistanceEstimator — the Radius Networks/AltBeacon empirical fit. Use it for parity
with other Android beacon stacks; its constants were fitted to one specific device.IBeaconDistanceEstimator for your own model.Samples are always fed through a windowed trimmed-mean filter first (RssiFilter), which is what
actually removes the jitter. On Apple platforms CoreLocation does its own filtering and hands back a
distance directly, so the filter and estimator are bypassed there — only the thresholds apply.
Proximity: Unknown, Immediate (<0.5m), Near (<3m), Far.BeaconRegionState: Unknown, Entered, Exited.Beacon.Distance is metres; a negative value means unknown, not "very close".EddystoneUid is a value type; Namespace is 20 hex chars, Instance is 12.AccessState is from Shiny.Core: Available, Denied, Disabled, Restricted, NotSupported, Unknown.| Platform | Ranging | Monitoring | Eddystone | Broadcast |
|---|---|---|---|---|
| iOS / Mac Catalyst | CoreLocation | CLMonitor (18+), CLLocationManager below | BLE scan | iBeacon only |
| macOS | CoreLocation | Not supported by the OS | BLE scan | iBeacon only |
| Android | BLE scan | BLE scan + foreground service | BLE scan | iBeacon + Eddystone |
| Windows | BLE scan | BLE scan | BLE scan | iBeacon + Eddystone |
| Linux | BLE scan | BLE scan | BLE scan | iBeacon + Eddystone |
| Blazor WASM | BLE scan | BLE scan | BLE scan | No |
| tvOS | — | — | — | — |
AccessState.NotSupported and throws
PlatformNotSupportedException from StartMonitoring. This is deliberate so shared startup code
runs unchanged; branch on CurrentStatus rather than on OperatingSystem.IsMacOS().startAdvertising accepts only a local name and service
UUIDs. StartEddystoneUid/StartEddystoneUrl throw PlatformNotSupportedException there.bluetoothd limits how
many advertising instances are active at once (LEAdvertisingManager1.SupportedInstances); when it
is full, RegisterAdvertisement fails and the exception carries BlueZ's own reason.navigator.bluetooth.requestLEScan, which is Chromium-only and behind
chrome://flags/#enable-experimental-web-platform-features. The chooser fallback reports no
advertisement payload, so beacons are invisible through it.iOS / Mac Catalyst Info.plist
NSLocationWhenInUseUsageDescription — required for rangingNSLocationAlwaysAndWhenInUseUsageDescription — required for monitoringNSBluetoothAlwaysUsageDescription — required for Eddystone and broadcastingAndroid AndroidManifest.xml
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<!-- monitoring only -->
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />
The foreground service type is connectedDevice, not location — Android 14 rejects a mismatched
type, and a BLE scan is not a location activity.
Windows — bluetooth capability in the app manifest for a packaged app.
Major cuts the scanning work and the false positives.Distance as an estimate with metres of error, not a measurement. Design around
Proximity buckets or "closest beacon wins" rather than absolute distances.DefaultTxPower against your actual hardware if the beacons advertise 0. The published
measured power of a beacon at one metre is the number to use.RegionExitTimeout rather than lower it if regions flap. The default 30s already tolerates a
1 Hz beacon interval and a throttled background scan.CurrentStatus before offering beacon features in the UI, so a macOS or tvOS build degrades
gracefully instead of throwing.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub shinyorg/skills --plugin shiny57 skills in this plugin
/localizegenGenerate strongly-typed localization classes from .resx resource files using Shiny.Extensions.Localization.Generator for .NET applications/shiny-accessorysetupGenerate code using Shiny.BluetoothLE.AccessorySetup - the system accessory pairing sheet for BLE devices (AccessorySetupKit on iOS 18+, CompanionDeviceManager on Android) with no MFi, no location prompt and no general Bluetooth prompt on iOS; picked accessories open as Shiny.BluetoothLE peripherals, and Android adds background presence (device appeared / disappeared) events/shiny-actorsGenerate code using Shiny.Actors — Orleans-style virtual actors without the ceremony, AOT/trim-clean, running anywhere .NET runs including .NET MAUI and Blazor WebAssembly. Covers actor interfaces and source-generated proxies, the ShinyActorBuilder (AddShinyActors), persistent state with ETags, named states and auto-save, event-sourced JournaledActor with snapshots, state and event migrations, typed streams (durable, implicit consumers), timers and persistent reminders (background jobs via Shiny.Jobs, on-time OS notifications via Shiny.Notifications), concurrency control ([Reentrant], [AlwaysInterleave], [ReadOnly], [StatelessWorker]), call filters and request context, OpenTelemetry traces and metrics, remoting over HTTP (Shiny.Net.HttpServer server, RemoteActorSystem client), mDNS discovery of actor servers, Shiny.DocumentDb storage (SQLite, PostgreSQL, IndexedDB...), and the ActorTestHost testing kit.Other plugins' skills for the same job