{"action":"created","issue":{"url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/41","labels_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/41/labels{/name}","comments_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/41/comments","events_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/41/events","html_url":"https://github.com/randdusing/BluetoothLE/issues/41","id":35007162,"number":41,"title":"iOS background scanning","user":{"login":"graphicgeek","id":1405963,"avatar_url":"https://avatars.githubusercontent.com/u/1405963?v=3","gravatar_id":"","url":"https://api.github.com/users/graphicgeek","html_url":"https://github.com/graphicgeek","followers_url":"https://api.github.com/users/graphicgeek/followers","following_url":"https://api.github.com/users/graphicgeek/following{/other_user}","gists_url":"https://api.github.com/users/graphicgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/graphicgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphicgeek/subscriptions","organizations_url":"https://api.github.com/users/graphicgeek/orgs","repos_url":"https://api.github.com/users/graphicgeek/repos","events_url":"https://api.github.com/users/graphicgeek/events{/privacy}","received_events_url":"https://api.github.com/users/graphicgeek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/randdusing/BluetoothLE/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2014-06-04T21:44:59Z","updated_at":"2015-10-21T13:54:31Z","closed_at":null,"body":"Does scanning fully work in the background in iOS?\r\n\r\nI've added the phonegap background plugin (https://github.com/hazemhagrass/phonegap-background), and Bluetooh is scanning in the background, but it does not get any results. I get results when I have the app open, just not when it is in the background. \r\n\r\nThe console shows the scanStart is succeeding when running in the background, just not getting results. Any thoughts?\r\n\r\nFYI, I'm testing on an iPad Mini."},"comment":{"url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/comments/149903135","html_url":"https://github.com/randdusing/BluetoothLE/issues/41#issuecomment-149903135","issue_url":"https://api.github.com/repos/randdusing/BluetoothLE/issues/41","id":149903135,"user":{"login":"randdusing","id":6188656,"avatar_url":"https://avatars.githubusercontent.com/u/6188656?v=3","gravatar_id":"","url":"https://api.github.com/users/randdusing","html_url":"https://github.com/randdusing","followers_url":"https://api.github.com/users/randdusing/followers","following_url":"https://api.github.com/users/randdusing/following{/other_user}","gists_url":"https://api.github.com/users/randdusing/gists{/gist_id}","starred_url":"https://api.github.com/users/randdusing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randdusing/subscriptions","organizations_url":"https://api.github.com/users/randdusing/orgs","repos_url":"https://api.github.com/users/randdusing/repos","events_url":"https://api.github.com/users/randdusing/events{/privacy}","received_events_url":"https://api.github.com/users/randdusing/received_events","type":"User","site_admin":false},"created_at":"2015-10-21T13:54:31Z","updated_at":"2015-10-21T13:54:31Z","body":"@De-Lac How long is your scan lasting for? After rereading Apple's documentation, a short scan may not pick up all the devices since it's waiting to coalesce all the advertisements into a single advertisement. That would kind of explain why I sometimes found my heart rate monitor and sometimes didn't with a scan interval of 10 seconds. Maybe increasing this to 20 seconds would have had better results.\r\n\r\n```\r\nAlthough you can perform many Bluetooth-related tasks while your app is in the background, keep in mind that scanning for peripherals while your app is in the background operates differently than when your app is in the foreground. In particular, when your app is scanning for device while in the background:\r\n\r\nThe CBCentralManagerScanOptionAllowDuplicatesKey scan option key is ignored, and multiple discoveries of an advertising peripheral are coalesced into a single discovery event.\r\nIf all apps that are scanning for peripherals are in the background, the interval at which your central device scans for advertising packets increases. As a result, it may take longer to discover an advertising peripheral.\r\nThese changes help minimize radio usage and improve the battery life on your iOS device.\r\n```"}}