Search code examples
iosiphonegeolocationibeacongeofencing

Connect 2 users when they come in certian region in iOS


I am working on one application where two users uses the application and am creating the region based on the user's current location.

Now what I want to achieve is when they come close and their region interact with each other, then both get notified that they have into one region.

Like showing in the picture. In picture1 the yellow is the region of one user,

enter image description here

as soon as their region interact with each other like depict in the second picture then both got notified.

enter image description here

How I can achieve that?


Solution

  • The typical way to accomplish this with iBeacon/CoreLocation/CoreBluetooth is with an app that transmits an iBeacon advertisement and looks for iBeacon advertisements:

    • All apps would use the same ProximityUUID for transmitting and receiving.
    • Apps would transit a unique major/minor combination identifying the app install.
    • Apps would monitor and range for beacons matching this ProximityUUID.
    • Apps would transmit an iBeacon advertisement with it's unique id encoded in major/minor.
    • When a beacon is ranged, the major/minor is read identifying the other user nearby.

    A few limitations of this approach:

    • iOS can only transit in the foreground
    • Ranging is limited to 10 secs in the background by default (extendable to 180 secs) after first beacon detection or leaving the foreground
    • If one beacon remains in the vicinity, a second beacon appearing will not trigger a background wakeup to start ranging