ios - Monitoring iBeacon beacons in background -


i've been developing ios app , playing around apple's corelocation , ibeacon technology. far used 3 beacons different uuids. ok until decided add more beacons app. ran strange issue. it's been said, single app can monitor 20 beacon regions @ once, when in background - in particular case, number seems 3. tried different approaches, nothing worked. when shuffled beacons in array outcome expected - first 3 beacon regions triggered didenterregion , didexitregion events when app in background. didn't applied when in foreground.

please consider this:

  1. i have array of custom beacon objects (consumed api)
  2. for each custom beacon object create instance of clbeaconregion so:

    let beaconregion = clbeaconregion(proximityuuid: nsuuid(uuidstring: region.uuid)!, identifier: region.uuid)  beaconregion.notifyonentry = true beaconregion.notifyonexit = true beaconregion.notifyentrystateondisplay = true 
  3. then pass instance cllocationmanager's startmonitoringforregion method so:

    locationmanager.startmonitoringforregion(beaconregion)

when looping through cllocationmanager's monitoredregions method response beacon regions expected regionstate 2 (outside)

  1. on top of i've added:

    nslocationalwaysusagedescription

to app's info.plist

locationmanager.requestalwaysauthorization() 

to viewcontroller's viewdidload method

still, didenterregion , didexitregion trigger when i'm in range of of first 3 beacon regions started monitoring for.

thanks,

piotr czarnoleski

an ios device has limited number of hardware acceleration slots beacon detection. these slots defer bluetooth chip notify operating system when beacon region pattern has been matched. when these slots used, background detections quick -- region entry event can happen within second or 2 of beacon transmission being in range.

if these slots run out, however, operating system must fall full scans find remaining regions. operating system throttles these save battery. evidence suggests take place every 15 minutes. means if regions monitored app don't hardware acceleration slot can take 15 minutes detected after matching beacon comes range (although on average take less time -- 7.5 minutes average)

how many hardware slots available? undocumented , may vary ios device model. experimentation shows may 30. across apps on phone , unrelated 20 region limit per app. first apps register regions first apps slots.

read more here: https://developer.radiusnetworks.com/2015/04/21/max-beacon-regions-ios.html

it possible above experiencing, , there 3 hardware acceleration slots left on phone app. test theory, can:

  1. uninstall other apps expect may registering beacon regions, should free more slots.
  2. wait 15 minutes see if detections other regions in background.

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -