Help with RangingListener

Hi guys, I’m starting to learn how to make apps with beacons. The thing is that I was tryng to make my app find beacons and show a message if is one near but when I use the app nothing happen. Here is the code if one of you could help me I’ll be very grateful.

package com.Cidjose30GmailCom.BeaconJhi;

import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;

import com.estimote.sdk.Beacon;
import com.estimote.sdk.BeaconManager;
import com.estimote.sdk.Region;
import com.estimote.sdk.SystemRequirementsChecker;
import com.estimote.sdk.service.BeaconService;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

public class MainActivity extends AppCompatActivity {

    private String texto;
    private BeaconManager beaconManager;
    private Region region;
    private TextView txtMensaje;

    protected void onCreate(Bundle savedInstanceState) {
        txtMensaje = (TextView)findViewById(;
        beaconManager = new BeaconManager(this);
        beaconManager.setRangingListener(new BeaconManager.RangingListener() {
            public void onBeaconsDiscovered(Region region, List<Beacon> list) {
                if (!list.isEmpty()) {
                    texto= "Encontrado";
        region = new Region("ranged region", UUID.fromString("B9407F30-F5F8-466E-AFF9-25556B57FE6D"), null, null);

    protected void onResume() {


        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            public void onServiceReady() {

    protected void onPause() {


    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(, menu);
        return true;

    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == {
            return true;

        return super.onOptionsItemSelected(item);

You’re using a RangingListener, but in your onServiceReady, you startMonitoring (: