Beacons - Monitoring
Beacon Monitoring allows you to scan for a region of beacons while your app is in the background, but will only provide values based exactly on the filters you have installed.
Setup
Registering a Beacon Region for Monitoring
IBeaconMonitoringManager manager;
await manager.StartMonitoring(new BeaconRegion( "MyBeaconRegion", "B9407F30-F5F8-466E-AFF9-25556B57FE6D", 1, 1));
Unregistering a Beacon Region for Monitoring
await manager.StopMonitoring(new BeaconRegion( "MyBeaconRegion", "B9407F30-F5F8-466E-AFF9-25556B57FE6D", 1, 1));
Background Delegate
using Shiny.Beacons;
namespace Sample.Beacons;
public partial class MyBeaconMonitorDelegate : IBeaconMonitorDelegate{ // works with dependency injection if you need it
public async Task OnStatusChanged(BeaconRegionState newStatus, BeaconRegion region) {
}}
#if ANDROID// this allows you to customize the foreground service notificationpublic partial class MyBeaconMonitorDelegate : IAndroidForegroundServiceDelegate{ public void Configure(AndroidX.Core.App.NotificationCompat.Builder builder) {
}}#endif