Etan,
Regarding this comment:
> If you want to perform iPhone to iPhone communication only, I suggest using GameKit for it.
…when using GameKit, for iOS <-> iOS device intercommunication, does the GKSession become invalid when a device goes into the background? If so, I wonder if GameKit is a practical choice for data exchange, particularly if the requirements of the data exchange in a particular app include user interaction within the data exchange, and thus introducing the possibility of one of the users putting the app into the background, invalidating the GKSession.
Thoughts?
-Allan
Hi Darren,
What's the bug report number for this?
Thanks, Joakim On Jan 11, 2013, at 8:23 AM, Darren Jones < email@hidden> wrote: Thanks Etan,
I have actually filed a bug report for the backgrounding of bluetooth-central stopping. I hope they fix it soon as there's so much more potential for apps when continuous background scanning is available. On 11 Jan 2013, at 16:21, Etan Kissling < email@hidden> wrote:
Darren,
OK. If you want to enable background scanning and advertising, just add the bluetooth-central and bluetooth-peripheral keys to the UIBackgroundModes array in your Info.plist.
bluetooth-central
| The app uses the CoreBluetooth framework to communicate with a Bluetooth accessory while in the background. This value is supported in iOS 5.0 and later. | bluetooth-peripheral
| The app uses the CoreBluetooth framework to communicate in peripheral mode with a Bluetooth accessory. This value is supported in iOS 6.0 and later. |
You will then receive the callbacks for around 45-60 minutes of background mode. After this, a bug prevents to receive more callbacks, as the connection is terminated as soon as your app is purged from the memory. After relaunching the app, scanning should resume to function properly.
Etan
wrote: Thank you. I want to use non pairing so CoreBluetooth is the way.
I'm glad it's possible. I wasn't sure if background scanning and advertising would be allowed.
On 11 Jan 2013, at 16:02, Etan Kissling <email@hidden> wrote:
Darren,
If you want to perform iPhone to iPhone communication only, I suggest using GameKit for it.
You will have an increased throughput, as classic Bluetooth is used as a transport, and don't have
to worry about specifying who is master and who is slave.
If you want to stay with CoreBluetooth: at least from the Bluetooth Core Specification, a device is
allowed to scan and advertise at the same time. I have not yet tried it under iOS, but can tell for your
background requirement that scanning times are pretty slow while backgrounded (around 55x
advertisement interval). Also don't forget to stop scanning and advertising as soon as you establish
a connection.
Etan
On 10.01.2013, at 23:59, Darren Jones <email@hidden> wrote:
Is it possible to use CBCentral scanning and CBPeripheral advertising at the same time? (Also in the background)
If I wanted 2 random iPhones to communicate and both where set to Central or both to Peripheral they wouldn't see each other. I'd like to remove that they would both have to know which method to activate.
Is that possible?
Thanks
Sent from my iPhone 5
|