mm24
mm24

Reputation: 9586

iBeacon: defining UUID

In the official iBeacon guide for developer Apple states that

Application developers should define a UUID specific to their app and deployment use case.

Question:

Looking at the quote above it seems up to the developer. However it feels like a non robust solutions.


If part B of question 1 is not possible then there would be the following use case that I am worried will happen:

Two companies have defined the same UUID for two different apps and a user has them both installed. The user enters in proximity with one of the iBeacons of one of the companies (both iBeacons do not have a minor and major value defined or both have the same minor and minor value).

Question 2:

Upvotes: 1

Views: 1017

Answers (3)

davidgyoung
davidgyoung

Reputation: 64916

The only official way to get a ProximityUUID is to generate one using a (secure) random UUID generator. It is statistically extremely unlikely that you will accidentally pick the same ProximityUUID as another company if you use a random UUID generator like one here. This is true because there are so many combinations, as @gnasher729 says in his answer. The chances of an accidental overlap are so low that it simply is not worth worrying about.

That said, there is nothing to stop somebody else from deliberately using the same ProximityUUID that you define. Because an iBeacon transmission is sent in clear text with no encryption, anybody with a Bluetooth LE scanner on Android, Mac or Windows device can read your ProximityUUID from a beacon over the air.

There is no way to stop this.

The way that Android and iOS apps cope with this by only using iBeacons for use cases where this is acceptable. If it is unacceptable for your use case, then you must look for another solution than offered by iBeacons.

Upvotes: 0

zaph
zaph

Reputation: 112857

A UUID is 128 bits long, and can guarantee uniqueness across space and time.

See A Universally Unique IDentifier (UUID)

iOS uuid code (Google for Android):

// Create a `NSUUID
NSUUID  *uuid = [NSUUID new];

// As a string:
NSString *uuidString = [uuid UUIDString];
NSLog(@"uuidString: %@", uuidString);

// As a bytes:
uuid_t uuidBytes;
[uuid getUUIDBytes:uuidBytes];

// as `NSData`:
NSData *uuidData = [NSData dataWithBytes:uuidBytes length:sizeof(uuid_t)];
NSLog(@"uuidData: %@", uuidData);

Output:

uuidString: 8F16F262-3E60-49F4-9D1B-FC4F4975B219
uuidBytes: 8F16F2623E6049F49D1BFC4F4975B219
uuidData: <8f16f262 3e6049f4 9d1bfc4f 4975b219>

Upvotes: 1

gnasher729
gnasher729

Reputation: 52538

It's a 128 bit UUID. Write a five line MacOS X program that creates and prints a UUID and use it.

There is a non-zero chance that a customer will complain to you about having the same UUID as another device. It is however more likely that one meteor strikes him, and another strikes you, and you both die, five seconds before he or she manages to complain.

That's how UUIDs work.

Upvotes: 4

Related Questions