Need help on android code of finding beacons

        connectionStatus.setText("Searching");
        connectionStatus.setTextColor(Color.YELLOW);
        deviceScanner.scanForDevices(new ConfigurableDevicesScanner.ScannerCallback() {
            @Override public void onDevicesFound(List<ConfigurableDevicesScanner.ScanResultItem> devices) {
                item = devices.get(0);
                // just take the first scanned item
                connection = connectionProvider.getConnection(item.device);
                // establish connection to scanned device
                connection.connect(new DeviceConnectionCallback() {
                    @Override
                    public void onConnected() {
                        connectionStatus.setText("Connected");
                        connectionStatus.setTextColor(Color.GREEN);
                        // update the connection status on UI
                        startCollection.setClickable(true);
                        // update the clickable for start collection button
                        beaconID.setText(item.device.deviceId.toString().toCharArray(), 0, item.device.deviceId.toString().toCharArray().length);
                        // update the ID of connected beacon
                    }

                    @Override
                    public void onDisconnected() {
                        connectionStatus.setText("Disconnected");
                        connectionStatus.setTextColor(Color.RED);
                        // update the connection status on UI
                        startCollection.setClickable(false);
                        // update the clickable for start collection button
                    }

                    @Override
                    public void onConnectionFailed(DeviceConnectionException e) {
                        connectionStatus.setText("Connection Fail");
                        connectionStatus.setTextColor(Color.RED);
                        // update the connection status on UI
                        startCollection.setClickable(false);
                        // update the clickable for start collection button
                    }
                });
                // scan and build connection to the node
            }
        });

This is the main part of code I get from the tutorial and apply to my app. However, during the test, my app never find the beacon right beside it and the status stuck at the “Searching”. I’m not sure if there are any problem about my code. Could anyone give me some help?

public class MainActivity extends AppCompatActivity {

    private BeaconManager beaconManager;
    private String scanId;

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

        
        System.out.println("------ Start Test ------");

        beaconManager = new BeaconManager(this);
        beaconManager.setNearableListener(new BeaconManager.NearableListener() {
            @Override
            public void onNearablesDiscovered(List<Nearable> nearables) {
                for (Nearable item : nearables) {
                    System.out.println(item.identifier);
                }
            }
        });
    }

    @Override
    protected void onStart() {
        super.onStart();
        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
                scanId = beaconManager.startNearableDiscovery();
            }
        });
    }

    @Override
    protected void onStop() {
        super.onStop();
        beaconManager.stopNearableDiscovery(scanId);
    }
}

This is my second try to read the broadcasting package. Still, there are nothing happened.

Could any one give me some help? I just want to collect some RSS data from the beacon and it shouldn’t be that hard.

The two code snippets you provided are for:

1st => connecting to beacons, that’s something you only need to do if you want to edit your beacon’s settings

2nd => scanning for Estimote Stickers

What exactly are you trying to do? If you only want RSSI, you don’t need to connect to your beacons, you can just scan for advertising packets that the beacons broadcast. Do you have stickers or regular beacons? If regular beacons, then you need to use ranging instead.

Tutorial:

http://developer.estimote.com/android/tutorial/part-1-setting-up/

Documentation:

https://github.com/Estimote/Android-SDK/blob/master/DOC_monitoring_scanning.md