Closed happyssm90 closed 6 years ago
In version 0.6.2 the onChangeAction returns a list that extends ProximityContext class. That list is sorted by proximity (nearest to farthest). So just getting the first one in the list would be enough.
ProximityContext nearest = proximityAttachments.get(0);
Thanks @ldimitroff .. Is it same for proximity-sdk:1.0.0 ?
I'd say it's the same thing, just get the first item in the set.
I don't know internally what kind of Set is implemented in the callback but to get the first item in the set is just simply
set.iterator().next();
This is also really simple to test anyways.
Hey @ldimitroff and @happyssm90
No, since version 1.0.0 there is a Set
of nearby context returned. The set by definition is not sorted, so getting the first element won't give you a closest beacon. We intentionally made it impossible to distinguish between beacon ranges, because of the BLE interferences and error rate of radio waves. It's not very reliable to find the closest beacon, and we don't want to deliver something that is not reliable ;)
If you want to track individual beacon, please make a Zone
for it, and write your desired distance using .withCustomRage(...)
.
Cheers, Paweł
Tracking a individual beacon it's not the same as having a sorted list with the closest beacon first :)
I think @pawelDylag answer didn't provide a solution to @happyssm90 nor to me that I'm actually using the same approach (and thinking rolling back to 0.6.2)
This question should remain open and not with the invalid tag. Thanks
onContextChange ProximityZoneContext> contexts
return only one element, but it is called multiple times for different beacons. Is there option to return all beacons at once?
Prerequisites
Basic information
Estimote SDK version: [estimote:proximity-sdk:0.6.2]
Android devices affected: [Samsung, One Plus]
Android OS version affected: [Oreo 8.1]
Beacon hardware version: [G1.12]
Description
I am able to find all the beacons using Tag Name, But How to find nearest beacon among them ? Below is My code