I want to display data to the textview from the database when the beacon is detected in specific distance .... the problem is it does not work or does not display anything here's my code ...
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
if (beacons.size() > 0) {
for (Beacon beacon: beacons) {
if(beacon.getDistance() < 0.5){
ddb();
//Call Display data from database
}
Does it has something to do with ranging every second?
Is it possible to display data from the database using didRangeBeaconsInRegion?
Try adding log lines to troubleshoot like this:
for (Beacon beacon: beacons) {
Log.d(TAG, "saw beacon:"+beacon+" with dist "+beacon.getDistance() );
if(beacon.getDistance() < 0.5) {
Log.d(TAG, " calling ddb");
ddb();
//Call Display data from database
}
}
Check to see that you see the first log line, and verify that if the distance is less than 0.5 the second log line is shown.