Greetings, a bit similar to this thread (OnNearablesDiscovered returns empty list?), in an Amazon Fire, with Android 4.4, setRangingListener does return a list with beacons, but setNearableListener always returns an empty list. If they didn’t show in either, I could think their battery is dead.
I’m basically using the demo code in the SDK for BeaconManager.
private static final UUID ESTIMOTE_PROXIMITY_UUID = UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D");
private static final Region ALL_ESTIMOTE_BEACONS = new Region("rid", ESTIMOTE_PROXIMITY_UUID, null, null);
beaconManager.setRangingListener(new BeaconManager.RangingListener() {
@Override
public void onBeaconsDiscovered(Region region, List<Beacon> beacons) {
for (Beacon beacon : beacons)
Log.d(TAG, "Beacon: " + String.format("%d:%d", beacon.getMajor(), beacon.getMinor()));
}
});
beaconManager.setNearableListener(new BeaconManager.NearableListener() {
@Override
public void onNearablesDiscovered(List<Nearable> nearables) {
Log.d(TAG, "Discovered nearables: " + nearables);
}
});
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override public void onServiceReady() {
// Beacons ranging.
beaconManager.startRanging(ALL_ESTIMOTE_BEACONS);
Log.d(TAG, "Starting ranging discovery");
// Nearable discovery.
beaconManager.startNearableDiscovery();
Log.d(TAG, "Starting nearable discovery");
}
});
Logcat shows
08-21 16:33:11.080 20383-20383/com.solutions.example.app D/MainActivity: Discovered nearables: []
08-21 16:33:11.080 20383-20383/com.solutions.example.app D/MainActivity: Beacon: 49162:44197
08-21 16:33:11.080 20383-20383/com.solutions.example.app D/MainActivity: Beacon: 23804:13389
08-21 16:33:11.080 20383-20383/com.solutions.example.app D/MainActivity: Beacon: 34225:35093
Over and over, nearables is always empty.
I tried add an ErrorListener to see if there was an error,
beaconManager.setErrorListener(new BeaconManager.ErrorListener() {
@Override
public void onError(Integer integer) {
Log.d(TAG, "Error id: " + integer);
}
});
But it never gets called
In my build.gradle I have this line
compile ‘com.estimote:sdk:0.11.0@aar’