How to programmatically set UUID, major ID, … and

2019-09-20 18:02发布

问题:

I am currently exploring retail advertising options. I am interested in AltBeacon as it is an open standard. I have a basic question, if someone can answer

How can I programmatically set UUID, major ID, minor ID, advertisements frequency, broadcasting power and RSSI at 1m in Altbeacon format on both (i) IOS devices and (ii) Android devices?

As Locate App is taking these values as variables from users, I guess they are inputting these values programmatically?!

回答1:

If you wan to know how to do this with the Android Beacon Library, this is explained on the sample code page

 Beacon beacon = new Beacon.Builder()
    .setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
    .setId2("1")
    .setId3("2")
    .setManufacturer(0x0118)
    .setTxPower(-59)
    .setDataFields(Arrays.asList(new Long[] {0l}))
    .build();
 BeaconParser beaconParser = new BeaconParser()
    .setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25");
 BeaconTransmitter beaconTransmitter = new BeaconTransmitter(getApplicationContext(), beaconParser);
 beaconTransmitter.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY);
 beaconTransmitter.setAdvertiseTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH);
 beaconTransmitter.startAdvertising(beacon);