Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS iBeacon: How to get all of proximityUUID programmatically?

Tags:

ios

ibeacon

I want to see all of proximityUUID of advertising packets programmatically. Some articles say that it is impossible on iOS but Android is possible. But I cannot believe it because I found the fantastic app "BLExplr" has the feature. I need to implement the function into my app. Does anyone knows how to do it or good examples? Any help will be appreciated.

(UPDATE 2014/1/17)

I believe @davidgyoung answer is right. Estimote beacon's proximityUUID is "B9407F30-F5F8-466E-AFF9-25556B57FE6D" but displayed my Estimote beacon's UUID on BLExplr app is another ID.

enter image description hereenter image description here

like image 906
zono Avatar asked Jan 16 '14 13:01

zono


People also ask

How do you read an iBeacon?

To identify each iBeacon, an iBeacon is identified using three numbers: Proximity UUID (16-bytes), Major (2 bytes), and Minor (2 bytes) (see Figure 1). Figure 1: Three numbers are used to identify an iBeacon . The assignment of these three numbers is totally up to the implementers.

What is the range of iBeacon?

The maximum range of an iBeacon transmission will depend on the location and placement, obstructions in the environment and where the device is being stored (e.g. in a leather handbag or with a thick case). Standard beacons have an approximate range of 70 meters. Long range beacons can reach up to 450 meters.

What is beacon UUID?

The UUID is the unique number generated for a specific Bluetooth Beacon and is able to be programmed to identify manufacturer, application or owner).

Can iBeacon work without an app?

Summary: For installations with regular beacons (an iBeacon is a type of beacon) then you cannot do much without an app, as you cannot interact with users (even after the additions from Eddystone).


2 Answers

Unfortunately, you cannot to this on iOS. When you say that BLExplr and LightBlue can do this, you are confusing the Bluetooth service UUID with the iBeacon Proximity UUID. These are two very different things.

The Bluetooth service UUID is visible to iOS, but has nothing to do with an iBeacon's identifiers, and is useless for working with iBeacons. The service UUID is generated by iOS each time a bluetooth device is seen, and stays the same only for the duration of time the bluetooth device is in range. If you take a bluetooth device away and bring it back later, it will have a different service UUID.

An iBeacon's identifiers (ProximityUUID, Major, Minor) are embedded inside the body of the Bluetooth advertisement. The problem on iOS devices is that Apple's CoreBluetooth APIs disallow access to the raw advertisement body, so no third-party app is able to read these identifiers. Apple only allows access to these identifiers using the special iBeacon CoreLocation APIs, but these APIs require you to know the Proximity UUID up front.

Sorry, I know this is not the answer you want to hear! (I'm sorry about it, too!) For what it's worth, you can do this on Android, on OSX Mavericks and Linux.

See details here.

like image 60
davidgyoung Avatar answered Oct 15 '22 14:10

davidgyoung


davidgyoung is partially wrong about not being able to get iBeacon info. You actually can get the proximity UUID on OS X, but not iOS.

In a CBPeripheral's advertisingData, there should be a key called kCBAdvDataManufacturerData; It is an NSData representing the iBeacon advertising information. This key is only available on OS X.

Check that the 2nd byte is equal to 0x02, the 1st two bytes are equal to 0x004c (76 in decimal), and the 4th byte (in decimal) + 4 equals the data's length (should be 25).

NSRanges (sorry for Mac syntax)
Proximity UUID: NSMakeRange(4, 16)
Major: NSMakeRange(20,2)
Minor: NSMakeRange(22,2)

To make sure you're doing it right, you can log the values as hex (use the format string %x) and make sure they match the description of the NSData from whence they came.

like image 30
Nate Symer Avatar answered Oct 15 '22 15:10

Nate Symer