I have an app that uses Bluetooth to connect with a Bluetooth device that gives a temperature reading. When the temperature reaches a certain level the alarm rings. It works perfectly fine in the foreground. The problem is I am not being able to get data from a device while it's in the background. Since the nature of the app is it must connect with Bluetooth devices and get data all the time. How can I run this kind of app in the background forever?
Asked
Active
Viewed 1,515 times
1
-
http://stackoverflow.com/questions/3762200/how-to-keep-an-iphone-app-running-on-background-fully-operational – Totumus Maximus Mar 06 '17 at 10:01
1 Answers
1
Have you requested the bluetooth-central
background mode?
See the Core Bluetooth Programming Guide for more:
If your app needs to run in background to perform certain Bluetooth-related tasks, it must declare that it supports a Core Bluetooth background execution mode in its Information property list (Info.plist) file. When your app declares this, the system wakes it up from a suspended state to allow it to handle Bluetooth-related events. This support is important for apps that interact with Bluetooth low energy devices that deliver data at regular intervals, such as a heart rate monitor.

Amy Worrall
- 16,250
- 3
- 42
- 65
-
In which situations app gets relaunched again. What if app is killed by user. Will it relaunched again in background. – Rohit Pradhan Sep 28 '17 at 11:09
-
I'm pretty sure if it's killed by the user, it will not get relaunched again. – Amy Worrall Mar 26 '18 at 12:36