BLE Notification when the application is not running - ios

Is there a possibility to receive BLE notification in your application for a specific UUID or whenever any UUID gets in range while the application is not running? E.g. the same way Push Notifications work?
I tried to google around but so far no helpful information that I could achieve. Any pointers?

Checkout background execution modes. The app does not need to run in foreground in this case, but it needs to have been started before and has to be in background at least.
iOS7 introduces a Bluetooth state preservation and restoration for long term Bluetooth tasks. By these means, even a terminated app will be restored in background mode by the os.

This is now possible after the iOS 7.1 update

Related

How Do i relaunch my iOS app from Kill state for long task?

First i will explain what i want to achieve.
I have a BLE lock. i want that my application will wake up from kill state and start scanning BLE device. Once the BLE device found it will connect with my phone and get unlock.
All this is working in background mode and i tested this many times. but i also want this to be work when app is in kill state.
I tried several things. First I tried Geofencing but in case of geofencing app wake up for less time i'm not properly scan the BLE device. When didEnterRegion region: called i sent the local notification and it was working fine. So after that i tried to scan BLE Devices when didEnterRegion region: and also get the notification that scan is started but i think after some time app remove from the background automatically and could not relaunch. So that's why i'm failed to discovered any BLE device.
I also read apple document for Core BlueTooth:
https://developer.apple.com/library/archive/documentation/NetworkingInternetWeb/Conceptual/CoreBluetooth_concepts/CoreBluetoothBackgroundProcessingForIOSApps/PerformingTasksWhileYourAppIsInTheBackground.html
There is mention that how to perform long task like open and close door lock but isn't help me.
Please guide me how to do this when app is in kill state.
Thanks for the help :)
UPDATE:
What i mean from kill state is suspended/ terminated/removed from background. I just want that once user get enter into the region of geofence then app launch in background and scanning for the BLE device started. so after that i want app will stay into the background until door get unlock.
As Paulw11 mentioned, there's no way to relaunch an app in the background once it is terminated/killed by the user. Apple have done this deliberately for security and functionality reasons: if a user deliberately kills an app because it is buggy/faulty, the app should not be able to relaunch itself.
More information can be found here:-
Core Bluetooth Background Processing for iOS Apps
BLE device keep connect with iPhone when application terminate
I hope this helps.
did u try SLC. It wakes up the app after a kill. Then u can run a long running background task for BLE activity.

CoreBluetooth cannot communicate without running app?

I want you to understand to my English skill is not good.
I'm developing an app using CoreBluetooth.
I checked I can do Bluetooth work in the background after running the app once (scanning, connect, get services).
However, I'm wondering if CoreBluetooth communication is possible in the background mode work without running the app at all.
For example, Once measurements are initiated on the peripherals, the central app will detect them and operate in background mode.
Is it possible?
I'm sorry that there is no code. Now I'm there is no method to start that.
I guess what you are looking for is CoreBluetooth State Preservation and Restoration. According to the documentation:
Because state preservation and restoration is built in to Core Bluetooth, your app can opt in to this feature to ask the system to preserve the state of your app’s central and peripheral managers and to continue performing certain Bluetooth-related tasks on their behalf, even when your app is no longer running.
When you opt in to state restoration, your app will be relaunched into the background on certain BLE related events. In particular, it keeps track of the following:
The services the central manager was scanning for (and any scan options specified when the scan started)
The peripherals the central manager was trying to connect to or had already connected to
The characteristics the central manager was subscribed to
Please be aware that there are limitations to what you can do while your app is using state restoration and background execution (you might be aware of that already).
Hope that helps
P.S.: We have found that state restoration only works while your iOS device is not attached to your development machine via USB cable (might be different with Xcode 9 now).

iOS background service using BLE after reboot

I'm new to mobile development, before eventually deciding where to develop (android/ iOS) a specific application I have a question (I'd prefer using an iPhone):
So the background is that I have a BLE device frequently sending data to the phone and let the phone app sync the data to the cloud. Now, it is really important that if for some reason the phone has to restart, it will automatically proceed receiving the BLE data.
Is it possible at all in iOS to start a background process (handling BLE packets) after reboot automatically. Thus e.g. when the respective BLE device pairs to the phone after a reboot, that the background process starts automatically, without the user having to start the app manually?
Doing some research I came up with mixed results regarding this scenario and would be grateful if someone with iOS experience could clarify.
(BTW: It does not have to be an Apple App Store Application)
A Few days ago I was working on BLE devices Beacons we supposed to make mobile application and start monitoring these beacons and send date monitoring to API.
This works fine in background, even the user was not running the application in foreground or reboot his iPhone.
All we should do is put the monitoring code at the appDelegate of the application to work in the background.

Push Notification App Running in Background When BLE is Connected

I worked on an Application which is Worked on BLE. i want push a notification ( App Running in Background When BLE is Connected) if any changes in Hardware. I Read Document
Even if your app supports one or both of the Core Bluetooth background execution modes, it can’t run forever. At some point, the system may need to terminate your app to free up memory for the current foreground app—causing any active or pending connections to be lost, for instance.
can i achieve my goal even my app in Background . If It is Possible Suggest me how to Achieve this . Thanks In Advance.
You may keep app in background by means of:
1.Audiosession(use this to play silent sound)
2.Location
3.VoIP
Any method can keep App in background and avoid App from being killed by system.
BLE Runs in the background, you need to specify that your app uses BLE Accessories or your app acts as a LE Accessory in the Background modes in app capabilities.
I've tried firing local notifications, while the application is in the background. BLE even works if the app is killed by the system, when the OS receives some communication from your peripheral or central, iOS wakes your app up and executes the desired function, before putting your app back to sleep.

Toggle iPhone Charging through OS X or XCode

I'm currently writing an iOS application and am receiving battery status change notifications. Of course, when I'm debugging my app it would be nice if I could toggle the battery status without unplugging my phone. Is there any way to do this via OS X or XCode, that is, while having the phone plugged in tell it to stop charging so I can test my notifications and actions?
Due to Apple's sandboxing regulations and firmware, you can not tell the phone to stop charging. This is a service extremely close to the core of the phone, and it can not be programmatically accessed.
Of course, when I'm debugging my app it would be nice if I could toggle the battery status without unplugging my phone.
Since you can't do that (per the accepted answer), an alternative that will help you debug is to create and send your own battery status notifications. The notifications are regular old NSNotification objects, and you can create and send your own with the name set to UIDeviceBatteryLevelDidChangeNotification or UIDeviceBatteryStateDidChangeNotification. That should let you trace through any code that would normally run when your app receives those notifications.

Resources