我正在使用Estimote定位信标和Android Studio来实现室内系统
我做了这段代码:
package com.example.hamat.name;
import android.app.Notification;
import android.location.Location;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.estimote.indoorsdk.IndoorLocationManagerBuilder;
import com.estimote.indoorsdk_module.algorithm.OnPositionUpdateListener;
import com.estimote.indoorsdk_module.cloud.CloudCallback;
import com.estimote.indoorsdk_module.cloud.EstimoteCloudException;
import com.estimote.indoorsdk_module.cloud.IndoorCloudManager;
import com.estimote.indoorsdk_module.cloud.IndoorCloudManagerFactory;
import com.estimote.indoorsdk_module.cloud.LocationPosition;
import com.estimote.cloud_plugin.common.EstimoteCloudCredentials;
import com.estimote.indoorsdk_module.view.IndoorLocationView;
import com.estimote.internal_plugins_api.cloud.CloudCredentials;
import com.estimote.indoorsdk_module.algorithm.ScanningIndoorLocationManager;
public class MyLocation extends AppCompatActivity {
IndoorLocationView indoorLocationView = (IndoorLocationView) findViewById(R.id.indoor_view);
Location location;
ScanningIndoorLocationManager indoorLocationManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_location);
// Connection to Estimote and the App
CloudCredentials cloudCredentials = new EstimoteCloudCredentials("ID ", "Token");
IndoorCloudManager cloudManager = new IndoorCloudManagerFactory().create(this, cloudCredentials);
// Get the saved map in estimote
cloudManager.getLocation("XXXXX The Map ID XXXXX", new CloudCallback<Location>() {
@Override
public void failure(EstimoteCloudException e) {
}
@Override
public void success(Location location) {
// view the map in the app ( have to insert it first in the Layout=========================
indoorLocationView = (IndoorLocationView) findViewById(R.id.indoor_view);
indoorLocationView.setLocation(location);
// scan beacons automatically==============================================================
indoorLocationManager = new IndoorLocationManagerBuilder(MyLocation.this, location)
.withDefaultScanner()
.build();
}
});
}
在位置变量中,我收到此错误消息
setLocation(com.estimote.indoorsdk_module.cloud.Location) in
IndoorLocationView cannot be applied to (android.location.Location)
我该怎么办? 你认为我在导入数据包时犯了一些错误吗?
答案 0 :(得分:0)
您正在导入错误的位置类型。在类开头的导入中,导入com.estimote.indoorsdk_module.cloud.Location而不是android.location.Location。记得在使用之前实例化变量