I am trying to transmit the major minor id from device making it an iBeacon using library
compile 'org.altbeacon:android-beacon-library:2.9.2@aar'
the code
if (mBeaconTransmitter != null) {
mBeaconTransmitter.stopAdvertising();
}
BeaconParser beaconParser=new BeaconParser();
mBeaconTransmitter = new BeaconTransmitter(getApplicationContext(), new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
int flag= mBeaconTransmitter.checkTransmissionSupported(this);
Log.v("@@@WWe"," BEacon Test "+flag);
Beacon beacon = new Beacon.Builder()
.setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setId2(majorID)//Major
.setId3(minorID)//Minor
.setBluetoothName("Vyas Pratik")
.setBeaconTypeCode(533)
.setManufacturer(0x0075) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setTxPower(-59)
.setMultiFrameBeacon(true)
.build();
// .setId2(minorID)//Major Try
// .setId3(majorID)//Minor Try
//.setBluetoothAddress(bluetoothManager.getAdapter().getAddress())
// .setDataFields(Arrays.asList(new Long[]{0l}))
mBeaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
@Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
super.onStartSuccess(settingsInEffect);
Log.v("@@@WWe"," Sucess "+settingsInEffect.toString());
}
@Override
public void onStartFailure(int errorCode) {
super.onStartFailure(errorCode);
Log.v("@@@WWe"," Error "+String.valueOf(errorCode));
}
});
However, my beacon using this code is detected in Locate app but not in beacon tools app /nearby (Google app).please guide me.
Thanks
After several trial and error trick, I got to a solution for this problem, the UUID, and manufacturer id was wrong. so I changed it to below value and the beacon is now detecting in google near by and beacon tools aswell
Beacon beacon = new Beacon.Builder()
// .setId1("2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")
// .setManufacturer(0x0118) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setId1("6d234454-cf6d-4a0f-adf2-f4911ba9ffa6")
.setManufacturer(0x4c) // Choose a number of 0x00ff or less as some devices cannot detect beacons with a manufacturer code > 0x00ff
.setId2(majorID)//Major
.setId3(minorID)//Minor
.setBluetoothName("Vyas Pratik")
.setTxPower(-59)
.build();