I am currently working on an app that requires me to scan a device using Bluetooth 4.0. At this point I have encounter a problem.
Is it possible to have the app scan the device when the app is running in the background? For some reason, the app cannot scan the device. The app did not call didDiscoverPeripheral while it was running in the background. However, my app can receive data from the device once connection has been establish.
To make things simpler, why can't my app scan the device while it is running in the background?
P.S. I did input the Required background modes 1.App communicates using CoreBluetooth 2.App shares data using CoreBluetooth
The bluetooth-central Background Execution Mode plist file, the Core Bluetooth framework allows your app to run in the background to perform certain Bluetooth-related tasks. While your app is in the background you can still discover and connect to peripherals, and explore and interact with peripheral data.
A device may use active scanning to obtain more information about devices that may be useful to populate a user interface. Active scanning involves more link layer advertising messages. So, for any usecase it will not be necessary to differ between those two scanning types.
On your iOS device go into "Settings-> Bluetooth" and turn on your BLE device. You should see the device listed in your available devices.
Scanning in the background is a very slow process. Apple says it's 55 times slower than in the foreground. My experience shows that it can be even slower. So in order to scan for a device in background keep in mind the following:
nil
services.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With