ondermerol
ondermerol

Reputation: 536

How to get the mac address of a beacon in objective-c without knowing its UUID, major and minor values?

In my application I need to search the nearest beacons and detect their mac addresses to calculate the user exact location in the building. The question is that can we detect the closest beacon mac address from the iOS application without the beacon's UUID, major and minor values?

Upvotes: 0

Views: 4520

Answers (3)

gnasher729
gnasher729

Reputation: 52530

Think about it: If you don't know the UUID of the beacon, how would you know it's location? A beacon doesn't know where it is. Someone must have physically put the beacons in their places, must have written down their locations, and must have made that location available to your app. In that case you would assume that they also wrote down the UUIDs.

Apple's idea is that you can't (easily) write an app that just finds any beacon. The beacons must be related to your app, otherwise they are none of your business. Let's say you write an app for a supermarket which uses the same UUID for all beacons. The app is supposed to ignore all other UUIDs.

Upvotes: 2

Paulw11
Paulw11

Reputation: 114783

The generic iBeacon protocol, as supported by Core Location, does not expose the beacons's MAC address. You need to know the UUID that is configured in your beacon and set this in your beacon region.

Other beacons may expose additional information as per the other answer.

Upvotes: 1

Krunal
Krunal

Reputation: 6490

Have you tried ?

- (void)beaconManager:(ESTBeaconManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(ESTBeaconRegion *)region
{
     self.beaconsArray = beacons;

     ESTBeacon *beacon = [self.beaconsArray objectAtIndex:i];
     NSLog(@"beacon.macAddress = %@",beacon.macAddress);

}

Upvotes: 2

Related Questions