i want to transmit a beacon using android beacon library as an ibeacon. i use the sample code from their site:
private void startIBeaconTransmit() {
Toast.makeText(context, "beacon transmission started", Toast.LENGTH_SHORT).show();
Beacon beacon = new Beacon.Builder()
.setId1("44918498-F5B3-4A21-AC3D-7CD9B4EA8BEB")
.setId2("1")
.setId3("2")
.setManufacturer(0x0000)
.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-25");
//.setBeaconLayout("m:0-3=4c000215,i:4-19,i:20-21,i:22-23,p:24-24");
beaconTransmitter = new BeaconTransmitter(getApplicationContext(), beaconParser);
beaconTransmitter.startAdvertising(beacon, new AdvertiseCallback() {
@Override
public void onStartSuccess(AdvertiseSettings settingsInEffect) {
Log.i("TAG", "onStartSuccess: ");
}
@Override
public void onStartFailure(int errorCode) {
Log.i("TAG", "onStartFailure: ");
}
});
}
i used different manufacturer codes and it didnt help i scan with another phone with an app that i downloaded from the playstore, i see my beacon as altbeacon, how can i change it to an ibeacon? thanks
You are very close!
Use the second beacon layout shown in the question (the one that is commented out) except change it to start with "m:2-3=0215
Then change the manufacturer code to use setManufacturer(0x004c)