4

I'm building an iOS App, in which I would wish to handle more than 20 iBeacons. Basically all beacons added to the web portal have to be handled by the App. Since there is an iOS restriction to number of region to be monitored as 20, I'm unable to give different local notifications for beacons in same region (having same UUID).

Is there any way to handle this?

kwl
  • 495
  • 6
  • 13
sreejith.virgo
  • 333
  • 1
  • 4
  • 15
  • Have a look at this http://www.plotprojects.com/how-to-monitor-more-than-20-regions-in-your-ios-app/ – Yanchi Jun 01 '15 at 11:36

1 Answers1

4

A few points:

  1. The 20 region limit applies to the number of CLRegion objects that can be registered by a single app. It does not mean you can only detect 20 beacons. Since each CLRegion object can leave the major and/or minor nil (making the fields a wildcard), each one can match billions of beacons.

  2. Beacon apps typically use local notifications, not push notifications.

The way you set up many different notifications to come from many different beacons is like this:

  1. Define a single wildcard region that matches all of your beacons. (Or a few regions if needed for background triggering).

  2. Start monitoring and ranging for each of these regions.

  3. In the didRangeBeacond:inRegion callback keep a flag for each individual beacon to see if you have sent a notification for it before. If not, set the flag to true and trigger a local notification specific to that beacon's identifiers.

davidgyoung
  • 63,876
  • 14
  • 121
  • 204
  • can you tell how can we define if `CLBeaconRegion` is nil ? – Jack Mar 21 '18 at 10:07
  • 1
    CLBeaconRegion cannot be nil. You must define a region with at least the ProximityUUID set. – davidgyoung Mar 21 '18 at 14:10
  • Exactly ! Thanks! , In my case i have 1000 beacons, & when keep all this in loop with `startMonitoringItem` it blocks `UI` Further i have added this on main thread, unfortunately receiving nothing in `didRangeBeacons` :( – Jack Mar 22 '18 at 10:26
  • 1
    You should post a new question as room is limited here. But know that you can only monitor a max of 20 regions. So you must collapse your regions and limit yourself to a max 20 proximityUUIDs. – davidgyoung Mar 22 '18 at 13:49