I put together a quick POC app with some beacons and I can’t seem to figure out how the Android SDK is determining what BLE scan mode to use (foreground or background). Even when the app is in foreground the app seems to use the background timing.
For reference the app is compiled against and running on:
- Min Android: API 21
- Target Android: API 23
- Running on Neuxs 5 (2013 edition) running API 23
I have an activity and a fragment. When i setup the beacon manager in the fragment I am passing it context from its associated activity (via a getContext() method i wrote)
//creating the beacon manager and giving it context beaconManager = new BeaconManager(TracActivity.getContext()); //setting up the scan rates beaconManager.setForegroundScanPeriod(foregroundScan, foregroundWait); beaconManager.setBackgroundScanPeriod(backgroundScan,backgroundWait);
However, the app only every seems to use the background scan rules. Thoughts?