{"action":"opened","issue":{"url":"https://api.github.com/repos/AltBeacon/android-beacon-library/issues/198","labels_url":"https://api.github.com/repos/AltBeacon/android-beacon-library/issues/198/labels{/name}","comments_url":"https://api.github.com/repos/AltBeacon/android-beacon-library/issues/198/comments","events_url":"https://api.github.com/repos/AltBeacon/android-beacon-library/issues/198/events","html_url":"https://github.com/AltBeacon/android-beacon-library/issues/198","id":82441309,"number":198,"title":"didRangeBeaconsInRegion called more then once per BackgroundScanPeriod and finds zero beacons","user":{"login":"AlexTrotsenko","id":4673265,"avatar_url":"https://avatars.githubusercontent.com/u/4673265?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexTrotsenko","html_url":"https://github.com/AlexTrotsenko","followers_url":"https://api.github.com/users/AlexTrotsenko/followers","following_url":"https://api.github.com/users/AlexTrotsenko/following{/other_user}","gists_url":"https://api.github.com/users/AlexTrotsenko/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexTrotsenko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexTrotsenko/subscriptions","organizations_url":"https://api.github.com/users/AlexTrotsenko/orgs","repos_url":"https://api.github.com/users/AlexTrotsenko/repos","events_url":"https://api.github.com/users/AlexTrotsenko/events{/privacy}","received_events_url":"https://api.github.com/users/AlexTrotsenko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-29T14:02:54Z","updated_at":"2015-05-29T14:02:54Z","closed_at":null,"body":"I have an issue with Nexus 5 in with scanning in background mode. \r\n\r\nFrom time-to-time I have `RangeNotifier.didRangeBeaconsInRegion()`  called *more then once* per `BackgroundScanPeriod`. Usually I notified about one result with proper `beacon info`. But then up to 9 notifications without any beacon appear every second. \r\n\r\nThis issue is happening with Android 5 API : `beaconManager.setAndroidLScanningDisabled(false);`.\r\n\r\nI have tested it without Android 5 API : `beaconManager.setAndroidLScanningDisabled(true);` and looks like it's works without any problems.\r\n\r\n\r\nModel: `Nexus 5`\r\nAndroid version: `5.1`\r\nBuild Number: `LMY471`\r\nWiFi : `On`\r\n\r\nAltBeacon lib version:\r\n- I have following dependency : `compile 'org.altbeacon:android-beacon-library:2+'`.\r\n- In .`../build/intermediates/exploded-aar/org.altbeacon/android-beacon-library/2.1.4/AndroidManifest.xml` I see `android:versionName=\"2.1.4\"`.\r\n\r\nFor testing following period / delay was used. But actually, I have same result with another periods as well. \r\n\r\n```.Java\r\n            beaconManager.setBackgroundScanPeriod(TimeUnit.SECONDS.toMillis(20));\r\n            beaconManager.setBackgroundBetweenScanPeriod(TimeUnit.SECONDS.toMillis(10));\r\n\r\n```\r\n\r\nSo, without AndroidLScanning I see, that `didRangeBeaconsInRegion` is called every `30 seconds` (20 + 10) :\r\n\r\n```\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:01:49.899\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:02:10.062\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:02:30.196\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:03:00.273\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:03:30.223\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:04:00.257\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:04:30.161\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:05:00.204\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:05:30.226\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:06:00.216\r\n```\r\n\r\nHere is full log:  https://gist.github.com/AlexTrotsenko/52c6b8bb2ec7e94d7440#file-log_beacons-txt\r\n\r\nBut with AndroidLScanning I see, that `didRangeBeaconsInRegion` sometimes called almost every second instead of once per `30 seconds` (20 + 10) :\r\n\r\n```\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:14:17.967\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:14:22.950\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:14:28.048\r\n\r\n........................................ <Somewhere here app have switched to Background >   ............\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:14:33.065\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:14:38.176\r\n\r\n..........................................<Start to call didRangeBeaconsInRegion more then once per period> ........\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:15:00.192\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 21351 : 15:15:01.284\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:02.345\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:03.416\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:04.441\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:05.527\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:06.598\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:07.666\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:08.745\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:15:09.824\r\n\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:15:30.256\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:16:00.252\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:16:30.313\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:17:00.201\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 2, 25287, 21351 : 15:17:30.292\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:18:00.210\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:18:30.244\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:19:00.212\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:19:30.276\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:20:00.200\r\n\r\n..........................................<Start to call didRangeBeaconsInRegion more then once> ........\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:30.342\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:20:31.464\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:32.487\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:33.539\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:34.585\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:35.627\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:36.650\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:37.748\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:38.816\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:20:39.846\r\n\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion. No new. : 15:21:00.218\r\nW/ALEX_BeaconsDispatcherService﹕ didRangeBeaconsInRegion 1, 25287 : 15:21:30.258\r\n```\r\n\r\nHere is full log: https://gist.github.com/AlexTrotsenko/70dfddf67b9063001b61\r\n\r\nPlease, let me know if you need any additional info.\r\nI read, that Android 5 API is more energy efficient, thus I would like to use them in my app.\r\n\r\nThank you in advance for any help."}}