Thanks for the quick response.
If I do set the info.plist property for "Required Background modes" to "App Communicates using CoreBluetooth", then I do see that my communication continues.
However, my understanding is that this is "Session-based Backgrounding" and that this should be avoided if possible. Since I am fine with the user getting a pop-up alert saying that my app wants to communicate an event, then the "Event Backgrounding" is
what I need to use.
Here is what I think I understand about the two models:
1. Event based (most common model)
- Apps may NOT interact with the peripheral while it is in the background.
- Keep connected to peripherals while in the background.
- Peripherals can send notifications to user (the user is given the "text message" alert notification).
2. Session Based
- Apps may interact with peripherals while in the background
- scan for peripherals with services (not generic scanning)
- connect to peripheral
- exchange data with peripheral
- App MUST HAVE a "Start and Stop" user interface.
- Special Info.plist entry is need to get access to session-based mode.
- BUT be mindful of power usage.
However, I cannot seem to get the event-based model to work. Also, I would like to know if there is a way to adjust the message that the user gets, just like with localNotifications.
Anders
On Oct 26, 2012, at 9:51 AM, András Kovi <
email@hidden> wrote:
Hi, you must add the bluetooth-central background mode. Otherwise your app is completely stopped. You won't receive disconnect or connect events either. Everything should start working correctly as soon as you add the flag.
Andras
On 2012.10.26., at 18:37, Anders Grunnet-Jepsen <
email@hidden> wrote:
This question pertains to backgrounding:
I am trying to create an app where I will get a notification from the peripheral even when the app has been exited or suspended.
I cannot find any specific documentation on how to do this, which leads me to believe that it must be obvious.
I want to do EVENT BACKGROUNDING (as opposed to session backgrounding).
I am able to successfully tell the peripheral to notify me (with [p setNotifyValue:YES forCharacteristic:characteristic]) and
I do receive data in the "didUpdateCharacteristics" when the app is active.
However when I exit the app, I do not get an alert.
What am I missing? Do I need to tailor the alert somewhere or set up a local notification?
I have not added any backgrounding flags to the info plist as I understand that should not be necessary for Event Backgrounding.
Also, I am not closing the Bluetooth connection upon exiting the app, so the iPhone should be able to receive the notifications, even when suspended.
Is there some specific command that the peripheral has to send?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
==========================
Anders Grunnet-Jepsen, Ph.D.
CTO
ThinkOptics, Inc.
5568 Del Oro Dr.
San Jose Ca 95124
+1 765-88-WAVIT [765-889-2848] (Office)
+1 408 823 0930
fax: 408 431 Wavit
==========================