Re-Connect Bluetooth Low Energy iOS - ios

I'm working on CoreBluetooth for 5 months. There is a topic which still I don't understand. I'm successfully connected and paired ble device with ios device in background and foreground. But when app is terminated by user, ble device disconnected. Some people say : application doesn't wake up when terminated by user via ble device. But I don't agree with them. Because
Tile App https://itunes.apple.com/us/app/tile-find-lost-keys-phone/id664939913?mt=8 doing this. I connect Tile device from Tile app then I swipe-kill app from the application list. Then I click tile button and Tile re-connect ble device. How can I do same thing with using CoreBluetooth ? I asked similar question on stackoverflow:
Re-connect bluetooth device when app is terminated

Related

Can anyone give me an idea of how a bluetooth device like silent beacon can send a command to the phone while the screen is closed

I am talking the silentbeacon.com personal safety alarm device. How is it able to connect with the phone with bluetooth while the screen is locked. I am looking for an IOS solution.
Just because the screen is locked on the iOS device doesn't mean it cannot do any Bluetooth functionality. iOS devices have a special background mode that allows them to continuously read BLE adverts and also communicate with remote BLE devices. You can find more about this here:-
CoreBluetooth background processing for iOS apps
BLE device keeps connecting with iPhone when app terminates
iOS - BLE scan and connect to peripheral in background

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.

When an iBeacon wakes an iOS app, will the WiFi radio power up?

Scenario: Backgrounded iOS app monitoring an iBeacon region. The device's WiFi radio was powered down by iOS (30 minutes of inactivity).
When the device enters the region of the the iBeacon and the app wakes to handle the location notification, will the WiFi radio power up and connect to an available remembered WiFi network?
Sending a local notification causes the lock screen to come up. I last tested this in the past (on iOS 6) and as of that OS version, this did cause a WiFi scan to start. Assuming this has not changed in subsequent iOS releases, then yes, this would work as you say.
To be clear, though, this is nothing specific to iBeacons -- this is just about the behavior of iOS when it brings up the lock screen due to a local notification.

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.

ios background task notification for BLE devices

I'm developing a "background task enabled" app that connects to a BLE (bluetooth low energy) device. The user opens the app and connects to the BLE while the app is in the foreground. Once the app goes to the background it will keep communication open with the device (if in range) and be alert of any information received from such device. Now my question is how do I handle or even notice that data is coming from the device? It seems that right now my notifications are queued and are only shown when I manually bring the app to the foreground.
Thanks,
Andres N.

Resources