ios background task notification for BLE devices - sdk

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.

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

Launch app in background when BLE device is in range

I'm making an iOS app to support a Bluetooth LE device. First time the app launches, we pair, but after that I want to communicate with the device whenever it is in range. Using background modes, this works fine for when the app is launched and goes into background and the screen is turned off. But, when the phone is rebooted, the app needs to be relaunched before it will be able to detect the device.
Is there any way to have the app launch in the background whenever the BLE device that it is paired to comes nearby?
In case of user forcibly kills the app by double clicking on home button and swipe out, it will not be relaunched until the user launches it again.
Coming to your case when Device is rebooted - Yes, you can configure State Preservation and Restoration to relaunch the app when user has not killed it forcibly before rebooting.
( Note: If the device requires a passcode to unlock, apps will not be relaunched until the device is unlocked for the first time after a restart )
Also, it is important to keep in mind that the app will be relaunched and restored if and only if it is pending on a specific Bluetooth event or action (like scanning, connecting, or a subscribed notification characteristic), and this event has occurred.
For more info:
Conditions Under Which Bluetooth State Restoration Will Relaunch An App

Re-Connect Bluetooth Low Energy 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

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.

Resources