When an app is not in the foreground, any advertising by it is done on a best effort basis, and it cannot be guaranteed, and there are some changes and limitations to the advertised data.
As Bluetooth is a shared resource, when other apps and system resources need to use Bluetooth, advertising for apps in the background will slow down, and may even stop for short periods of time.
To perform certain peripheral role tasks while in the background, you must include the UIBackgroundModes key with the bluetooth-peripheral value in your app’s Info.plist file.
That said, you should be aware that advertising while your app is in the background operates differently than when your app is in the foreground. In particular, when your app is advertising while in the background:
- The
CBAdvertisementDataLocalNameKey advertisement key is ignored, and the local name of peripheral is not advertised. - All service UUIDs contained in the value of the
CBAdvertisementDataServiceUUIDsKey advertisement key are placed in a special “overflow” area; they can be discovered only by an iOS device that is explicitly scanning for them. - If all apps that are advertising are in the background, the frequency at which your peripheral device sends advertising packets may decrease.
If the Central device which will consume these advertisement packets is not an Apple device, it will not be possible to decode the overflow area. The format of this area is not documented.