Google Proximity Beacon API: how to register iBeac

2020-03-18 04:02发布

问题:

The Google's Proximity Beacon API documentation uses Eddystone as an example everywhere:

https://developers.google.com/beacons/proximity/register

However, documentation mentions two more types of beacons, AltBeacon and iBeacon.

If I understand correctly, something like this should be used (adapted from Google's example):

 {
  "advertisedId": {
   "type":"IBEACON",
   "id":"base 64 of what???"},
  "status":"ACTIVE",
  "latLng": {
     "latitude": 51.4935657,
     "longitude": -0.1465538
   }
}

However, what is the acceptable binary format for iBeacon's UUID,Major,Minor (which should be base64'd)?

回答1:

The id of the advertisedId will be the 20 bytes of the iBeacon UUID + major + minor base64 encoded directly from the binary form. (i.e. don't print it out as hex or text first before base64 encoding. Just take the blob and base64 that).

Otherwise your request looks right!