Empty telemetry list

Using Android SDK I’m trying to detect Estimote Telemetry packet from a beacon but the method onTelemetryFound recives an empty list.
Anyway, on the Estimote Cloud, I can see telemetry data updated from my phone (the only device who comunicates with the beacons is the same I use to try to detect Telemetry packets).

Here is the code

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        beaconManager=new BeaconManager(this);
        beaconManager.setTelemetryListener(new BeaconManager.TelemetryListener() {
            @Override
            public void onTelemetriesFound(List<EstimoteTelemetry> telemetries) {
                for(EstimoteTelemetry tlm: telemetries)
                {
                    t3+=tlm.toString();
                }
            }
        });

Any suggest?

Do you call beaconManager.startTelemetryDiscovery();? You should invoke it after onServiceReady

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

I don’t see any of those in your code snippet.

Yes, I put that code in the onStart method

What exact SDK version are you using? What is your phone model and OS version?

Estimote SDK 1.2.0, android 6 on an LG K8

That is ancient SDK. Latest is 1.4.1.
Other two things that might me missing here:

  • SDK initialisation (you should get big error message in logs when it is missing)
EstimoteSDK.initialize(getApplicationContext(), "your id", "your token");
  • Bluetooth and Location permissions (there should also be message in logs). It can be accomplished by calling
  @Override
  protected void onResume() {
    super.onResume();
    SystemRequirementsChecker.checkWithDefaultDialogs(this);
  }

Also done,
this is all the code

package com.estimote.proximitycontent;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;

import com.estimote.coresdk.cloud.model.Color;
import com.estimote.coresdk.common.requirements.SystemRequirementsChecker;
import com.estimote.coresdk.recognition.packets.EstimoteTelemetry;
import com.estimote.coresdk.service.BeaconManager;
import com.estimote.proximitycontent.estimote.EstimoteCloudBeaconDetails;
import com.estimote.proximitycontent.estimote.EstimoteCloudBeaconDetailsFactory;
import com.estimote.proximitycontent.estimote.ProximityContentManager;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class MainActivity extends AppCompatActivity
{
    private String t2;
    private static final String TAG = "MainActivity";
    private BeaconManager beaconManager;
    private String scanId;
    private Telemetria telemetry;
    String t3;

    private static final Map<Color, Integer> BACKGROUND_COLORS = new HashMap<>();

    static {
        BACKGROUND_COLORS.put(Color.ICY_MARSHMALLOW, android.graphics.Color.rgb(109, 170, 199));
        BACKGROUND_COLORS.put(Color.BLUEBERRY_PIE, android.graphics.Color.rgb(98, 84, 158));
        BACKGROUND_COLORS.put(Color.MINT_COCKTAIL, android.graphics.Color.rgb(155, 186, 160));
    }

    private static final int BACKGROUND_COLOR_NEUTRAL = android.graphics.Color.rgb(160, 169, 172);

    private ProximityContentManager proximityContentManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        beaconManager=new BeaconManager(this);
        beaconManager.setTelemetryListener(new BeaconManager.TelemetryListener() {
            @Override
            public void onTelemetriesFound(List<EstimoteTelemetry> telemetries) {
                t3+=telemetries.size();
                for(EstimoteTelemetry tlm: telemetries)
                {
                    /*telemetry=(Telemetria)tlm;
                    t3+=telemetry.toString();*/
                    t3+=tlm.toString();
                }
            }
        });

        proximityContentManager = new ProximityContentManager(this,
                Arrays.asList(
                        "58ad9509c764bf73c3d7497669fdd710",
                        "6fbbccfaedf2f9f7a45226e97c983b2e",
                        "926839986df91ec123d4c89beeec6604"),
                new EstimoteCloudBeaconDetailsFactory());
        proximityContentManager.setListener(new ProximityContentManager.Listener() {
            @Override
            public void onContentChanged(Object content) {
                String text;
                Integer backgroundColor;

                if (content != null) {
                    EstimoteCloudBeaconDetails beaconDetails = (EstimoteCloudBeaconDetails) content;
                    text = "You're in " + beaconDetails.getBeaconName() + "'s range!";
                    backgroundColor = BACKGROUND_COLORS.get(beaconDetails.getBeaconColor());
                } else {
                    text = "No beacons in range.";
                    backgroundColor = null;
                }
                ((TextView) findViewById(R.id.textView)).setText(text+" "+t3);
                findViewById(R.id.relativeLayout).setBackgroundColor(
                        backgroundColor != null ? backgroundColor : BACKGROUND_COLOR_NEUTRAL);
            }
        });
    }

    @Override
    protected void onResume() {
        super.onResume();

        if (!SystemRequirementsChecker.checkWithDefaultDialogs(this)) {
            Log.e(TAG, "Can't scan for beacons, some pre-conditions were not met");
            Log.e(TAG, "Read more about what's required at: http://estimote.github.io/Android-SDK/JavaDocs/com/estimote/sdk/SystemRequirementsChecker.html");
            Log.e(TAG, "If this is fixable, you should see a popup on the app's screen right now, asking to enable what's necessary");
        } else {
            Log.d(TAG, "Starting ProximityContentManager content updates");
            proximityContentManager.startContentUpdates();
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d(TAG, "Stopping ProximityContentManager content updates");
        proximityContentManager.stopContentUpdates();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        proximityContentManager.destroy();
    }

    protected void onStart()
    {
        super.onStart();
        beaconManager.connect(new BeaconManager.ServiceReadyCallback()
        {
            public void onServiceReady()
            {
                beaconManager.startTelemetryDiscovery();
            }
        });
    }
}

I generated template from Cloud, pasted your code there and run on Xiaomi MI 5 with Android 6.0.1 and SDK 1.2.0.
I only put a log line inside telemetry listener:

      beaconManager.setTelemetryListener(new BeaconManager.TelemetryListener() {
            @Override
            public void onTelemetriesFound(List<EstimoteTelemetry> telemetries) {
                t3+=telemetries.size();
                for(EstimoteTelemetry tlm: telemetries)
                {
                    /*telemetry=(Telemetria)tlm;
                    t3+=telemetry.toString();*/
                    t3+=tlm.toString();
                    Log.i(TAG, tlm.toString());
                }
            }
        });

And it works. I see logs with telemetry data.
Maybe ProximityContentManager is not triggering and it is not displaying information on the screen (because all information is in t3)?
Can you check that code on different phone?

I can see data but not the first time I connect the beacon to the device: the app enters beacon’s range and it doesn’t detect any telemetry data, if I exit and enter the range again it finds telemetry.

Why are you connecting to beacon? I don’t see any connection code there.
By looking at code you only display information on the screen when phone enters/exists beacon range.
Have you added that logging to onTelemetriesFound?

1 Like

No, I mean connecting to find the beacon… sorry