Re: CoreBluetooth in the Background (iOS)
Hi, It seems to be working now, although scanning interval in background is extremely large. In my case it scans every 15 minutes (iOS 5.0.1). My BTLE chip advertises every 300ms, so based on what I've read in archive it should actually discover it in less than a minute. Maybe anybody had a similar problem? Basically the only thing I changed from the original code is queue parameter in original scan request from [[CBCentralManager alloc] initWithDelegate: self queue: dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)] to [[CBCentralManager alloc] initWithDelegate: self queue: nil] which should default to dispatch_get_main_queue(), so not sure if it actually made any difference. Probably I'll also try to run it on 5.1.1 later on, to check if background scanning interval is any better. regards, Murad On Fri, Aug 31, 2012 at 10:18 AM, m.kroll <m.kroll@mac.com> wrote:
Hi Murad,
I set the filters to match my devices primary service and it was still not discoverable in the background :-( There are two questions concerning CoreBluetooth which are still unanswered for me:
- The background discovery issue - Which USB Dongle is supported by the iOS Simulator (when will it work in ML again).
Kind Regards/Mit freundlichen Grüssen, Dr. Michael Kroll. --- Blog: http://www.mkroll.mobi Forum: http://forum.mkroll.mobi
On Aug 31, 2012, at 09:15 AM, Murad Kamalov <muradkam@gmail.com> wrote:
Thanks András, I'll check the archives. As it seems so far thought, event after 10 minutes of waiting phone doesn't discover BLE devices in the background mode, but maybe it's related to scans' filtering options.
regards, Murad
On Thu, Aug 30, 2012 at 5:10 PM, András Kovi <allprog@gmail.com> wrote:
Hi Murad,
Your app keeps working but discovery is 55 times slower and the peripheral filtering option of scan is discarded. If it takes 1 sec in foreground to discover in foreground, then it will take almost a minute in background. These issues have been discussed extensively on this list recently. It may be useful for you to search the archives for some answers.
Regards, Andras Sent from the iPhone
On 2012.08.30., at 16:00, Murad Kamalov <muradkam@gmail.com> wrote:
Hi,
I'm writing an app for iOS 5.1, which would connect to discovered BTLE devices and read some data off them (BTLE devices advertise proprietary Bluetooth service).
Currently it works in the foreground mode, but I want to make it work in the background mode. This should be possible with CoreBluetooth.
Based on Apple documentation, I've added UIBackgroundModes key with the "bluetooth-central" value in its Info.plist, but it doesn't seem to be working. Whenever I turn off the iPhone's screen or just put application into the background, it just stops receiving CoreBluetooth discovery (centralManager:didDiscoverPeripheral:advertisementData:RSSI: callback) notifications and I can't discover/connect to BTLE devices around. Do you have a guess what could be the problem?
As I mentioned before in foreground mode application works just fine.
Thanks for the help, Murad _______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/bluetooth-dev/akovi%40myringguard.co...
This email sent to akovi@myringguard.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/m.kroll%40mac.com
This email sent to m.kroll@mac.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Bluetooth-dev mailing list (Bluetooth-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/bluetooth-dev/site_archiver%40lists.... This email sent to site_archiver@lists.apple.com
participants (1)
-
Murad Kamalov