Does iOS scan beacon even if bluetooth is off - ios

I am developing app which interacts with iBeacon. I've seen my app is able to detect iBeacon even if bluetooth is off. I am unable to find any documentation of this behaviour. Can anyone share official verdict/documentation what actually is going on behind the scene?
Thanks

When you tap the Bluetooth icon in Control Center to turn it “off” the icon changes from Blue to Grey, but this does not turn off Bluetooth. It just disables Bluetooth connections while allowing iBeacon scanning and scanning for other Bluetooth devices to continue.
You can verify this for yourself by turning the Bluetooth icon to the off position in Control Center like this:
Then drill down into settings to see that the Bluetooth switch is still enabled but below that connections are now disabled.
You cannot detect if a phone is in this state, but if your app constructs a new CBCentralManager when the phone is in this state, iOS will automatically put up a dialog like this:
If you are not using CBCentralManager, then it doesn't make any difference whether the phone is in this state or not -- you can scan for other devices (iBeacon using CoreLocation or non-iBeacon bluetooth devices using CoreBluetooth) the same way regardless of whether the phone is in this mode.

Related

How to scan near by bluetooth devices in background mode or screen lock mode

I am using core Bluetooth central manager and peripheral functionality for one of my applications. In which I want to find nearby devices based on Bluetooth name.
Can anyone share a reference link or sample code to scan nearby Bluetooth devices in background mode or screen lock mode

Core Bluetooth scan for peripherals while the phone's screen is off

I need to keep scanning for broadcasts from peripherals while the app is in background and when the phone's screen is off. Scanning from background was successful but I can't scan (can't trigger didDiscoverPeripheral) broadcasts when the phone' screen is off.
So far I've implemented beginBackgroundTaskWithExpirationHandler inside applicationDidEnterBackground and that's how I am able to scan in background. So how should I do this?
This is not possible.
When you tick 'Uses Bluetooth LE accessories' and 'Acts as a Bluetooth LE accessory', when iPhone screen light is turned off, core bluetooth framework stops advertising and scanning. It resumes advertising/scanning once the screen light turns back on. That's the maximum possible achievable scenario in iOS.
If you want to take this further, you can use beginBackgroundTaskWithExpirationHandler - https://developer.apple.com/documentation/uikit/uiapplication/1623031-beginbackgroundtaskwithexpiratio but that works hardly for 3 minutes. Those 3 minutes start as soon as the app goes from foreground to background.
For saving battery, iOS seems to automatically turn off the BLE hardware and it goes back on as soon as the device moves/screen wakes up. Because when screen is off, user isn't using the iPhone anyway.
Edit: Unless a device is connected, like a headphone- Though not advertising, existing connected devices can share data.

BLE pheripheral not detected when ios app on background

i am develop a ble based iOS application on iOS 8.0. i have a peripheral device, that advertise data . am just open my application , the scanning started on viewdidload. then it detect the peripheral and listed in a table view. it is working fine. but when am switch off the peripheral device, after am start the iOS app, scanning started on didload, and am pressed center key, then app going to background. after am just switch on peripheral device. but it could not detect the device.
(current situation, am switch off and on the bluetooth of an iOS device manually. then background app detected the peripheral and got notification message.)
what is the actual problem with my app? and if any solutions?
Make sure you have enabled the proper background mode in the target capabilities page. Go to the Capabilities tab for your target and switch "Background Modes" to ON, the check "Uses Bluetooth LE accessories".

Background mode for Bluetooth PAN accessory

I have an accessory which receives internet connection via iPhone Personal hotspot.
And I developed a service on the device from which I plan to pull updates every 1 minute. Or as an alternative it keeps consistent websocket connection.
I know that I can communicate to my device through Bluetooth PAN is possible however I would like to do it in background while the device is connected.
If someone is interested I asked a question before about this: Is possible to communicate via Bluetooth PAN in iOS with tethered devices
What background mode could be used to keep consistent connection with my accessory through Bluetooth PAN network? Could modes "bluetooth-central" or "bluetooth-peripheral" or "external-accessory" be used without using CoreBluetooth or ExternalAccessory framework?

How to control iOS app from BLE device for background processing without putting the application in front

I'm developing a Bluetooth Low Energry (BLE) enabled DSLR (digital camera) controller that receives GPS coordinates and allows remote focus/shutter controls.
In the ideal case, I'd not have to take my iPhone out of my pocket.
The BLE device connects as soon as my camera is turned on, and this should launch the app if it's not launched already. When the camera is turned off, BLE disconnects and the app should go into sleep mode (stop updating location and sending data over BLE) (note that app might be in background at this time). When the camera is turned off again (while app is in background/iphone locked), the app should reconnect and start updating location and sending data to the BLE receiver.
It's a lot to ask and might be too good to be true, but is this possible?
(iOS 7+ SDK is OK)
You can operate as a Bluetooth LE central (scanning for peripherals) in the background - Refer to the Core Bluetooth Programming Guide however, while in the background peripheral scanning and detection may not happen as quickly as when the app is in the foreground.
Your app could post a local notification when the peripheral was detected, and the user could respond to this notification to launch your app into the foreground, but you cannot force your app into the foreground without user interaction. You can send information to the camera via BLE even while your app is in the background and you can receive location information while in the background too - refer to the Core Location programming guide.
The disconnection is straight-forward. When you detect a disconnection you can shut down location services to conserve battery power.

Resources