Tracking temperature using telemetry


#1

Hi
I’m following the example given on the Estimotes developers doc. Code is as follows

package e.user.estimotetelemetry;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.estimote.coresdk.recognition.packets.EstimoteTelemetry;
import com.estimote.coresdk.service.BeaconManager;

import java.util.List;

public class MainActivity extends AppCompatActivity {
    private BeaconManager beaconManager;
    private BeaconManager bm;
    private String scanId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        beaconManager = new BeaconManager(this);

      /*  bm = new BeaconManager(getApplicationContext());
        bm.setNearableListener(new BeaconManager.NearableListener() {
            @Override
            public void onNearablesDiscovered(List<Nearable> nearables) {
                scanId= beaconManager.startTelemetryDiscovery();

            }
        }); */
        beaconManager.setTelemetryListener(new BeaconManager.TelemetryListener() {
            @Override
            public void onTelemetriesFound(List<EstimoteTelemetry> telemetries) {
                for (EstimoteTelemetry tlm : telemetries) {
                    Log.d("TELEMETRY", "beaconID: " + tlm.deviceId +
                            ", temperature: " + tlm.temperature + " °C");
                }
            }
        });
            }

    @Override protected void onStart() {
        super.onStart();
        beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
            @Override
            public void onServiceReady() {
       //         scanId =  beaconManager.startTelemetryDiscovery();  // This line shows up an incompatibility error as : incompatible types required java.lang.string found void
            }
        });
    }
    @Override
    protected void onStop() {
        super.onStop();
     //   beaconManager.stopTelemetryDiscovery(scanId); //incompatible types required java.lang.string found void
    }
    }

It’ll be great if someone could help with this. Thanks in advance!


#2

I see you are using old SDK which is deprecated for ranging and monitoring. You should use Proximity SDK for that. See https://github.com/Estimote/Android-Proximity-SDK#scanning-for-estimote-telemetry
What problems do you have with your existing code? I see you commented line that starts telemetry discovery. Without it is won’t scan anything. I also don’t see SDK initialisation. Have you enabled telemetry packets on you beacons?


#3

Hey thanks!
I’ve commented those lines here and not in the actual code. The comments are made to show the lines that are causing error.