Hi,
I am detecting still and moving beacon
NSUUID *stillUUID = ESTIMOTE_PROXIMITY_UUID;
CLBeaconRegion *staticRegion = [[CLBeaconRegion alloc] initWithProximityUUID:stillUUID identifier:@"Still"];
[self.beaconManager startMonitoringForRegion:staticRegion];
[self.beaconManager startRangingBeaconsInRegion:staticRegion];
NSUUID *motionUUID = [ESTBeaconManager
motionProximityUUIDForProximityUUID:stillUUID];
CLBeaconRegion *motionRegion = [[CLBeaconRegion alloc] initWithProximityUUID:motionUUID
major:56544
minor:15767
identifier:@"Motion"];
[self.beaconManager startMonitoringForRegion:motionRegion];
[self.beaconManager startRangingBeaconsInRegion:motionRegion];
`
but my problem is I am not able to check motion of multiple beacons, can you please help!!!
Just clone what you have done already for each additional beacon:
CLBeaconRegion *staticRegion1 = [[CLBeaconRegion alloc]
initWithProximityUUID:stillUUID major:123 minor:456
identifier:@"beacon 1 motionless"];
CLBeaconRegion *motionRegion1 = [[CLBeaconRegion alloc]
initWithProximityUUID:motionUUID major:123 minor:456
identifier:@"beacon 1 in motion"];
CLBeaconRegion *staticRegion2 = [[CLBeaconRegion alloc]
initWithProximityUUID:stillUUID major:987 minor:654
identifier:@"beacon 2 motionless"];
CLBeaconRegion *motionRegion2 = [[CLBeaconRegion alloc]
initWithProximityUUID:motionUUID major:987 minor:654
identifier:@"beacon 2 in motion"];
… and start monitoring and ranging for these.
Note: the staticRegion
you’ve defined is too broad: you only used the UUID, and you need to use UUID+major+minor, like I’ve shown above.
Hi @heypiotr,
I understand the above code, but my concern is, I want to recognise which beacon is moving in a generic way, means not by hardcoding major and minor value. is there any way to do that.
thanks
Ah, got it! In this case, you could do:
CLBeaconRegion *staticRegion = [[CLBeaconRegion alloc]
initWithProximityUUID:stillUUID
identifier:@"all my motionless beacons"];
CLBeaconRegion *motionRegion = [[CLBeaconRegion alloc]
initWithProximityUUID:motionUUID
identifier:@"all my beacons in motion"];
i.e., simply omit the major + minor.
You will also want to change your beacons’ UUID to your own one, not the default Estimote one (i.e., B9407F30-F5F8-466E-AFF9-25556B57FE6D), if you haven’t done this already.
This should work great with ranging—each second, you will get two calls to the didRangeBeacons
delegate: one for the staticRegion
, with a list of all your beacons (and their majors and minors) that are motionless, and one for the motionRegion
, with a list of all your beacons that are in motion.