RE: How to make BLE app work on background of iPhone4S
RE: How to make BLE app work on background of iPhone4S
- Subject: RE: How to make BLE app work on background of iPhone4S
- From: Sean <email@hidden>
- Date: Sat, 10 Dec 2011 13:12:22 +0800
Hi Brian,
Thank you for your support. I using the “Session Backgrounding”
and can read data from LE accessory. But I suffer one issue as below.
Once accessory power off during APP in background mode. System
will call delegate “didDisconnectPeripheral” automatically. I want my LE APP to
connect with the LE device automatically once LE device be powered on. So I
call “scanForPeripheralsWithServices” in “didDisconnectPeripheral”,
but I can’t find LE device ( program will never go into “didDiscoverPeripheral”.
But if I make APP to foreground mode then will discover peripheral immediately).
Could you please give me some idea about it?
From: Brian Tucker
[mailto:email@hidden]
Sent: Saturday, December 10, 2011 1:34 AM
To: Sean
Cc: email@hidden
Subject: Re: How to make BLE app work on background of iPhone4S
Hi Sean,
There are two modes of backgrounding for
Apps that use CoreBluetooth: Event and Session.
Event backgrounding is probably what most
Apps will use when interacting with Bluetooth Low Energy devices. This
mode does not allow for direct communications to the accessory when the App is
in the background, but does provide for a notification from the accessory when
it wants to communicate with the app. iOS will stay connected to the BTLE
accessory when your App is in the background and will continue to monitor for
notifications. When the connected BTLE accessory has a notification
available, iOS will notify the user that the accessory would like to talk to
your App, allowing the user to load your App and interact with the accessory.
As many devices need to conserve power, only providing information at
deterministic times will greatly enhance the battery life of the accessory and
the iPhone 4S.
- No info.plist entries are required for
this mode.
There are times where an App must interact
with an accessory even if it is running in the background. Consider a
running app that needs to monitor heart rate real-time. There is a clear
START and STOP to this model. The user STARTS their run in the App. While
the run is active, the App reads heart rate information until the run is
completed or STOPED. Session backgrounding also allows for scanning and
connection to BTLE accessories while the App is in the background. A scanForPeripheralsWithServices or
connectPeripheral call will continue, even when the App is in the
background. CoreBluetooth will continue to monitor for specific
peripherals or peripherals that match the services your App is looking for and
call your Apps delegate when found or connected. Be mindful, that every
time a BTLE peripheral or iPhone 4S uses its radio, it is depleting the
respective devices available power. App developers using session based
backgrounding must be mindful of power usage.
- Session backgrounding requires a
backgrounding mode entry to UIBackgroundModes, bluetooth-central, in
your Apps info.plist.
On Dec 9, 2011, at 2:37 AM, Sean wrote:
I
have a question for how to make BLE app still working during app go to
background mode on iPhone4S?
_______________________________________________
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
|
_______________________________________________
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