I’m following the example given on the Estimotes developers doc. Code is as follows I'm facing an 'incompatible type error" when trying to pass the value to scanID variable.
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);
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!
The API for telemetry discovery changed slightly, and it looks like the docs haven't been updated accordingly—I've just fixed that.
In the most recent version of the SDK, startTelemetryDiscovery
no longer returns a scanId
, and stopTelemetryDiscovery
no longer accepts one. You just start and stop the scan:
@Override protected void onStart() {
super.onStart();
beaconManager.connect(new BeaconManager.ServiceReadyCallback() {
@Override
public void onServiceReady() {
beaconManager.startTelemetryDiscovery();
}
});
}
@Override protected void onStop() {
super.onStop();
beaconManager.stopTelemetryDiscovery();
}