简体   繁体   中英

BLE Scanning in background State of iOS app

There is any API OR third party for BLE communication in iOS app background state..?I tried “Uses Bluetooth LE accessories”,”Background Processing”,”Background fetch” with these capabilities BL Scanning is working but Advertisement data packet decrease.In app foreground state advertisement data packet increase..how can I get maximum quantity of advertisement data packets.? I am using service UUID for Scanning.

As Rob Napier said, scanning in the background state as aggressively as in the foreground state is impossible by design because the system has lower resources and is attempting to save power. This is detailed in Apple's Core Bluetooth Programming Guide:-

For iOS apps, it is crucial to know whether your app is running in the foreground or the background. An app must behave differently in the background than in the foreground, because system resources are more limited on iOS devices.

Although you can perform many Bluetooth-related tasks while your app is in the background, keep in mind that scanning for peripherals while your app is in the background operates differently than when your app is in the foreground. In particular, when your app is scanning for device while in the background:

  • The CBCentralManagerScanOptionAllowDuplicatesKey scan option key is ignored, and multiple discoveries of an advertising peripheral are coalesced into a single discovery event.

  • If all apps that are scanning for peripherals are in the background, the interval at which your central device scans for advertising packets increases. As a result, it may take longer to discover an advertising peripheral.

These changes help minimize radio usage and improve the battery life on your iOS device.

You can find more information here:-

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM