Apple has some very interesting limitations on Bluetooth especially when it comes to background scanning
Make sure to add the following to your Info.plist
<array>
<string>bluetooth-central</string>
</array>
To add a description to the Bluetooth request message (on iOS 10 this is required!)
<key>NSBluetoothPeripheralUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>
- Device names are not available at all
- When scanning in the background, pass a ScanConfig argument with a service UUID you wish to scan for. Without this, you will get nothing
BleAdapter.Current.Scan(
new ScanSettings
{
ServiceUUID = new Guid("<your guid here>")
}
)
.Subscribe(scanResult =>
{
})
This feature is only provided on iOS. It allows for a CBCentralManager to be restored upon a device reconnection (and in turn, get the device that reconnected) There is additional configuration required to use this event
// in your iOS application AppDelegate, do the following:
BleAdapter.Init(BleAdapterConfiguration.DefaultBackgroudingConfig);
// then in your shared code (somewhere near your initialization)
BleAdapter.Current.WhenDeviceStateRestored().Subscribe(device =>
{
// will return the device(s) that are reconnecting
});