Estimote Telemetry:无法跟踪温度

Estimote Telemetry : Unable to track temperature

我正在按照 Estimotes 开发人员文档中给出的示例进行操作。代码如下 尝试将值传递给 scanID 变量时遇到“类型不兼容错误”。

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
}
}

如果有人可以提供帮助,那就太好了。提前致谢!

遥测发现的 API 略有变化,文档似乎没有相应更新——我刚刚修复了这个问题。

在最新版本的SDK中,startTelemetryDiscovery不再returns一个scanIdstopTelemetryDiscovery不再接受一个。您只需开始和停止扫描:

@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();
}