I'm a newbie in android development and I am using altbeacon library and the reference app for altbeacons we also have a 2 Pibeacons....... the reference works fine and able to detect both beacons ...I want to do something if the app detected a specific beacon ...for example i want to display a string if I detected a beacon in near proximity....the first 2 if statement works fine but if I added a condition to determine which beacon is in near proximity the 3rd if statement does not work....the first beacon minor is 1 and the 2nd is 2
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
for (Beacon beacon: beacons) {
if(BeaconProximity.getProximityString(beacon.getDistance()) == "Near"){
logToDisplay("Hello");
}
if(BeaconProximity.getProximityString(beacon.getDistance()) == "Immediate"){
logToDisplay("Hi");
}
if(BeaconProximity.getProximityString(beacon.getDistance()) == "Near" && beacon.getId3 == Identifier.parse("1"){
logToDisplay("World");
}
}
}
if I only display beacon.getId3 and Identifier.parse("1") like this code logToDisplay(beacon.getId3()+"="+Identifier.parse("1") it will output 1=1 they are equal but if I make that a condition ... It does not work ...so I dont know whats wrong or am I missing something or Is there another way to insert a command or codes if I detected a specific beacon in near,far,immediate proximity?