Hi,
We are using de indoor location sdk but with some problems.
We can create a map and get the position, but the position only get updates when we turn de screen to horizontal.
Our code is the following, can you help us?
public class MapaActivity extends AppCompatActivity {
IndoorLocationView indoorLocationView;
ScanningIndoorLocationManager indoorLocationManager;
public static final String ESTIMOTE_APP_ID = "APP_ID";
public static final String ESTIMOTE_APP_TOKEN = "APP_TOKEN";
@Override
protected void onCreate(Bundle savedInstanceState) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 200);
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.ACCESS_COARSE_LOCATION}, 200);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_mapa);
buttonUbicacion();
buttonDestino();
//buttonInfo();
IndoorCloudManager cloudManager = new IndoorCloudManagerFactory().create(getApplicationContext(), new EstimoteCloudCredentials("APP_ID", "APP_TOKEN"));
cloudManager.getLocation("fiesta-405", new CloudCallback<Location>() {
// Get Credentials
final EstimoteCloudCredentials cloudCredentials;
cloudCredentials = new EstimoteCloudCredentials(ESTIMOTE_APP_ID, ESTIMOTE_APP_TOKEN);
// Create IndoorManager object.
IndoorCloudManager cloudManager = new IndoorCloudManagerFactory().create(this, cloudCredentials);
// el otro mapa es : 517
cloudManager.getLocation("lab-amarillo", new CloudCallback<Location>() {
@Override
public void success(Location location) {
IndoorLocationView indoorLocationView = (IndoorLocationView) findViewById(R.id.indoor_view);
// Init indoor location view
indoorLocationView = findViewById(R.id.indoor_view);
indoorLocationView.setLocation(location);
// Store the Location object for later,
// you will need it to initialize the IndoorLocationManager!
indoorLocationManager =
new IndoorLocationManagerBuilder(getApplicationContext(), location, cloudCredentials)
.withPositionUpdateInterval(5000)
.withDefaultScanner()
.build();
indoorLocationManager.setOnPositionUpdateListener(new OnPositionUpdateListener() {
@Override
public void onPositionUpdate(LocationPosition position) {
System.out.println ("[DEBUG] onPositionUpdate <---------");
System.out.println (position.component1());
System.out.println (position.component2());
indoorLocationView.updatePosition(position);
}
@Override
public void onPositionOutsideLocation() {
System.out.println ("[DEBUG] onPositionOutsideLocation <---------");
indoorLocationView.hidePosition();
}
});
indoorLocationManager.startPositioning();
}
@Override
public void failure(EstimoteCloudException e) {
// oops
Toast.makeText(getApplicationContext(), "Oops, problems!", Toast.LENGTH_LONG).show();
}
});
}
@Override
protected void onStart(){
super.onStart();
//indoorLocationManager.startPositioning();
}
@Override
protected void onStop(){
super.onStop();
indoorLocationManager.stopPositioning();
}
Are using the example code in a bad way?
Thank you!!!