How to separate operations by area with iBeacon

Asked 1 years ago, Updated 1 years ago, 107 views

I would like to install several iBeacons so that when I enter the area of each Beacon, I can do other things (background).

I thought it would be possible to change the Major with the same UUID, but would it be possible to recognize which Major's Beacon was grabbed and entered the area within DidEnterRegion?

Or do we monitor the beacons of multiple UUIDs and decide what happens when we enter the area for each UUID?

ios objective-c ibeacon

2022-09-30 15:34

3 Answers

I don't think I could get Major or Minor in DidEnterRegion.

-(void) locationManager:(CLLocationManager*) manager didEnterRegion:(CLRegion*)region{
    if([region isMemberOfClass:[CLBeaconRegion class]]){
        manager startRangingBeaconsInRegion: (CLBeaconRegion*) region;
    }
}

Call startRangingBeaconsInRegion within DidEnterRegion as above,

-(void) locationManager:(CLLocationManager*) manager didRangeBeacons:(NSArray*)beacons inRegion:(CLBeaconRegion*) region{
    for (CLBeacon* beacon in beacons) {
        if([beacon.major intValue]==1){
            // Processing
        }
    }
}

You should be able to determine within DidRangeBeacons.


2022-09-30 15:34

I'm sorry, but I've never directly coded for iBeacon, but I did something similar with GeoFencing.Wouldn't it be possible to refer to the major as follows?

 - (void) locationManager: (CLLocationManager*) manager
         DidEnterRegion: (CLRegion*)region
{
    if([region isKindOfClass:[CLBeaconRegion class]]) {
        CLBeaconRegion*breakion=(CLBeaconRegion*)region;
        if([brevision.major intValue] == 1) {
            ...
        }


2022-09-30 15:34

Within the DidEnterRegion, you cannot obtain Beacon details such as major or minor.
Major, minor information is only available within DidRangeBeacons.

However, didRangeBeacons cannot continue to run in the background.

for use in the background StartRangingBeaconsInRegion with DidEnterRegion triggered and
Wouldn't it be better to use the major and minor values that can only be obtained for about 10 seconds?

However, if Beacon equipment is close or the radio output is high,
Note that the same UUID has overlapping areas.
In that case, it might be better to separate the UUID.


2022-09-30 15:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.