Best way to Combine Monitoring and Ranging

Hi,

i am currently developing an app which should track a user through an event. The indoor event has several rooms, each equipped with an iBeacon. The app should send statistics how long the user was inside that specific room.

Notes:

  • there are more than one exits/entries for the room
  • there are more beacons than 20 (so defining each beacon as a region does not work on iOS)
  • the tracking should also work, when the app is closed (not only in background, but really closed)

My implementation works like this:
all the beacons have the same UID, the major is defining the event, the minor the room of the event

  1. i am monitoring the region by providing the UID
  2. when entering the region i am starting a ranging with the UID-Region for 10 seconds and use all the returned becaons as new regions for monitoring. If no beacon can be ranged i will start the process with step 1. I use the nearest beacon for tracking
  3. whenever i leave one of this regions i am starting with the above listed step number 2

The problem with this solution is that i do net get a lot of exit/entry events on the region when the beacon is not perfectly configured. Therefore i am thinking about adjusting the process like this:

  1. as above
  2. when entering the region i am starting ranging and will track the nearest beacon
  3. when leaving the region i will stop ranging since the user left the event

I see one problem with this adjusted process and that’s the battery life time.
Do i miss sth or is this the best solution?

Thx for your help