Question

Here my approach.

Broadcating beacon with UUID and identifier like this.

NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:@"B57A1B68-48B7-4DBF-914C-760D08FBB87B"];

// Initialize the Beacon Region
self.myBeacon = [[CLBeaconRegion alloc] initWithProximityUUID:uuid
                                                              major:1
                                                              minor:1
                                                         identifier:@"com.mycompany.xxx"];

And extracting beacon info like this

-(void)locationManager:(CLLocationManager*)manager
   didRangeBeacons:(NSArray*)beacons
          inRegion:(CLBeaconRegion*)region
{
CLBeacon *beacon = [beacons firstObject];
NSLog(@"becons details = %@",beacon);
}

And the result

 becons details = CLBeacon (uuid:<__NSConcreteUUID 0x178038200> B57A1B68-48B7-4DBF-914C-760D08FBB87B, major:1, minor:1, proximity:1 +/- 0.11m, rssi:-40)

This how I get the major value

NSString *major = [NSString stringWithFormat:@"%@", foundBeacon.major];

Please anybody help me how to get the identifier value like "com.company.xxx" from the broadcasting beacon?

Thank you.

Was it helpful?

Solution

Unfortunately, you can't. Those identifiers are only helpful within the same application, but they don't actually get physically broadcasted in the bluetooth packets.

An alternative would be for the app to act as a peripheral and advertise services and characteristics which contain this company identifier value, but this approach is not as passive as iBeacons and would require a central to actively connect to the peripheral and read the characteristic values. It's not as hard as it sounds, but really depends on your use case.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top