Empty list of discovered beacons


#1

I don’t know why the toast notifications always prints 0 even thow there are more than 5 beacons in less than 2 meters.

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        beaconManager = new BeaconManager(this);
        region = new BeaconRegion("ranged region", null /*UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D")*/, null, null);


        beaconManager.setForegroundScanPeriod(500, 1000);
        beaconManager.setRangingListener(new BeaconManager.BeaconRangingListener() {
            @Override
            public void onBeaconsDiscovered(BeaconRegion region, List<Beacon> list) {
                Toast.makeText(getApplicationContext(), ((String)(""+list.size())), Toast.LENGTH_LONG).show();
              }
        });
    }

Nearables can not be detected
#2

Have you tried longer scan periods? 500 ms can be a bit too short for some less responsive Android devices.

FYI, since it seems like you’re using the github.com/estimote/android-sdk. The proximity-detection (enter/exit monitoring, ranging) APIs in that SDK are deprecated—they will no longer receive updates/improvements, unless it’s critical bug or security fixes. We recommend switching to the github.com/estimote/android-proximity-sdk. Integration tutorial is here: https://developer.estimote.com/proximity/android-tutorial/


#3

I’ve already followed the tutorial but it doesn’t work…

Marco Rocchi


#4

Hmm, what was the problem?


#5

The function onBeaconsDiscovered always recive an empty list, even thow near my phone there are 4 or 5 beacons.


#6

Where do you call beaconManager.connect() and 'beaconManager.startRanging(…)` ? I don’t see it in code snippet.
Do you have something like this in your code?

 beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
        @Override
        public void onServiceReady() {
            beaconManager.startRanging(region);
      }
    });

startRanging should be called after onServiceReady is invoked.


#7

Here is the complete code with some adjustment and the same issue… as you can see I am calling the beaconManager.connect() function.

public class MainActivity extends AppCompatActivity {

    private BeaconManager beaconManager;
    private BeaconRegion region;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        beaconManager=new BeaconManager(getApplicationContext());
        beaconManager.setRangingListener(new BeaconManager.BeaconRangingListener() {
            @Override
            public void onBeaconsDiscovered(BeaconRegion beaconRegion, List<Beacon> beacons) {
                Toast.makeText(getApplicationContext(), "ranging listener   "+beacons.size(), Toast.LENGTH_LONG).show();

            }
        });
        region=new BeaconRegion("regione", UUID.fromString("7F07FEFA-34CE-50C6-D630-6ADFF41C0ADD"), 1, 1);
        beaconManager.setMonitoringListener(new BeaconManager.BeaconMonitoringListener() {
            @Override
            public void onEnteredRegion(BeaconRegion beaconRegion, List<Beacon> beacons) {
                Toast.makeText(getApplicationContext(), "entrato   "+beacons.size(), Toast.LENGTH_LONG).show();
            }

            @Override
            public void onExitedRegion(BeaconRegion beaconRegion)
            {

            }
        });
        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            public void onServiceReady() {
                beaconManager.startRanging(region);
            }
        });

        beaconManager.startRanging(region);


    }

    protected void onResume()
    {
        super.onResume();
        SystemRequirementsChecker.checkWithDefaultDialogs(this);
    }
  }

What I need is to have a list of beacons in range and detect their distance


#8

I run you code on Xiaomi Mi6 (Android 6.0.1) and it scans without a problem. I only modified

region=new BeaconRegion("regione", UUID.fromString("7F07FEFA-34CE-50C6-D630-6ADFF41C0ADD"), 1, 1);

to

 region=new BeaconRegion("regione", null, null, null);

so I can scan for all iBeacons.
Can you check if it helps? Also knowing your phone model, its Android version and Estimote SDK version may help.


#9

LG K8 with Android 6.0, Estimote SDK 1.4.1 and still doesn’t working.

The beacon is broadcasting Estimote Monitoring, Estimote Location, Estimote Telemetry and IBeacon packets


#10

Can you share some logcat logs and btsnoop logs? Maybe there is an error message telling why phone is not starting scanning.


#11

I’m having some problems with the logcat but I’ve tried to run the ap on another Android 6.0 device and it isn’t working.

I’ll share the logcat as soon as I can.


#12

Can you use nRF Connect and scan for those beacons? This way we can eliminate phone as the potential source of this problem.


#13

I have a dev kit 10cm away from my phone


#14

Here is using the Estimote app


#15

Estimote app uses Proximity SDK for scanning. Maybe that is the reason it is working. Android SDK 1.4.1 is deprecated for scanning.
I don’t see also EstimoteSDK.initialize(...) in your code. Do you have it in your Application class?
You may try to use those flags before BeaconManager initialisation:

    Flags.DISABLE_BATCH_SCANNING.set(true);
    Flags.DISABLE_HARDWARE_FILTERING.set(true);

#16

Now it finds the list of beacons but all beacons in the list are null


#17

But what actually helped? 'EstimoteSDK.initialize` or one of the flags? Can you check that? Does the logcat show any errors or strange messages?


#18

The flags.
EstimoteSDK.initialize was already in the app in another activity.