Always onPositionOutsideLocation


#1

I am using Indoor SDK on android, i follow all indication on github but always call onPositionOutsideLocation function.

My code:

package com.jpglobaldigital.jpviewerar;

import android.content.Context;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.estimote.indoorsdk.EstimoteCloudCredentials;
import com.estimote.indoorsdk.IndoorLocationManagerBuilder;
import com.estimote.indoorsdk_module.algorithm.IndoorLocationManager;
import com.estimote.indoorsdk_module.algorithm.OnPositionUpdateListener;
import com.estimote.indoorsdk_module.algorithm.ScanningIndoorLocationManager;
import com.estimote.indoorsdk_module.cloud.CloudCallback;
import com.estimote.indoorsdk_module.cloud.CloudCredentials;
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.Location;
import com.estimote.indoorsdk_module.cloud.LocationPosition;
import com.estimote.indoorsdk_module.view.IndoorLocationView;

public class MainActivity extends AppCompatActivity {

IndoorLocationView indoorView;
ScanningIndoorLocationManager indoorLocationManager;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    EstimoteCloudCredentials cloudCredentials = new EstimoteCloudCredentials("SETTHISFORSECURITY", "SETTHISFORSECURITY");
     final IndoorCloudManager cloudManager = new IndoorCloudManagerFactory().create(getApplicationContext(), cloudCredentials);

    cloudManager.getLocation("rocando-s-location", new CloudCallback<Location>() {
        @Override
        public void success(Location location) {
            // do something with your Location object here.
            // You will need it to initialise IndoorLocationManager!


            indoorLocationManager =  new  IndoorLocationManagerBuilder(getApplicationContext(), location, new EstimoteCloudCredentials("jpmobileexperience-a54", "eb37f022c9c7d80bb91097ab05ec93d4")).withDefaultScanner().build();

            indoorLocationManager.setOnPositionUpdateListener(new OnPositionUpdateListener() {
                @Override
                public void onPositionUpdate(LocationPosition position) {
                    // here, we update the IndoorLocationView with the current position,
                    // but you can use the position for anything you want

                    indoorView.updatePosition(position);
                }

                @Override
                public void onPositionOutsideLocation() {
                    indoorView.hidePosition();
                }
            });

            indoorLocationManager.startPositioning();

            indoorView = (IndoorLocationView) findViewById(R.id.indoor_view);
            indoorView.setLocation(location);

        }

        @Override
        public void failure(EstimoteCloudException e) {
            // oops!
            System.out.println( "Hola " + e);
        }
    });
}


@Override
protected void onStart() {
    super.onStart();

}

@Override
protected void onStop() {
    super.onStop();
    if (indoorLocationManager != null)
        indoorLocationManager.stopPositioning();
}

}