Slow telemetry refresh or no data

Hi there, we are working on a project to collect telemetry data. In its final shape we want to send signals or push json data to the web when the telemetry value go higher or lower than threshold. For now, we just want to display the data in the app. We have a working code without errors. I see that the data is uploaded to the cloud and visible in the dashboard but not in the app. Perhaps you may know what is wrong with the code?

private BeaconManager beaconManager;
public double temperature;
public double ambientLight;
public Vector magnetometer;
public DeviceId deviceId;
public boolean motionState;
public double pressure;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_estimote_test);
    EstimoteSDK.initialize(this, "####", "####");
    EstimoteSDK.enableDebugLogging(true);
    beaconManager = new BeaconManager(this);
    beaconManager.setTelemetryListener(new BeaconManager.TelemetryListener() {
        @Override
        public void onTelemetriesFound(List<EstimoteTelemetry> telemetries) {
            for (EstimoteTelemetry tlm : telemetries) {
                temperature = tlm.temperature;
                ambientLight = tlm.ambientLight;
                magnetometer = tlm.magnetometer;
                deviceId = tlm.deviceId;
                motionState = tlm.motionState;
                pressure = tlm.pressure;
            }
        }
    });
    telemetry();
}

public void telemetry() {
    TextView a = findViewById(R.id.temperature);
    a.setText(String.valueOf(temperature));
    TextView b = findViewById(R.id.ambientLight);
    b.setText(String.valueOf(ambientLight));
    TextView c = findViewById(R.id.magnetometer);
    c.setText(String.valueOf(magnetometer));
    TextView d = findViewById(R.id.deviceId);
    d.setText(String.valueOf(deviceId));
    TextView e = findViewById(R.id.motionState);
    e.setText(String.valueOf(motionState));
    TextView f = findViewById(R.id.pressure);
    f.setText(String.valueOf(pressure));
}

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

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

Hey @norbi

I would recommend you trying our new ProximitySDK :rocket: for this. There is a possibility to scan for telemetry data there, and it is as simple as this:

BluetoothScanner scanner = new EstimoteBluetoothScannerFactory(applicationContext).getSimpleScanner();
BluetoothScanner.ScanHandler scanHandler = scanner.estimoteTelemetryFullScan()
   .withBalancedPowerMode()
   .withOnPacketFoundAction(new Function1<EstimoteTelemetryFull, Unit>() {
     @Override
     public Unit invoke(EstimoteTelemetryFull estimoteTelemetryFull) {
       /* Do something with the received telemetry packet here */
       return null;
     }
   })
   .start();

What is more, you can boost the speed of your scan for individual sensors, using partial scan with estimoteTelemetryFrameAScan or estimoteTelemetryFrameBScan instead of estimoteTelemetryFullScan. Read the specification of our telemetry frames here.

This SDK is still in beta - this is why we don’t have all the dev docs ready yet, but it already functions very well. If you want you may read more here about use-cases for telemetry scan using Android Things platform on RaspberryPi. Let me know what you think :slight_smile:

Regards,
Paweł

Thanks! I’ll move to ProximitySDK and check if it solved the problem.