Can't get lat long using IndoorAtlas sdk in android

239 views Asked by At

My Code is following , control is not reach at onLocationChanged method, i am using physical device not emulator. Please give your suggestions,thank you.

private IALocationListener locationListener = new IALocationListener() {
    @Override
    public void onLocationChanged(IALocation location) {
        Log.d(TAG, "Latitude: " + location.getLatitude());
        Log.d(TAG, "Longitude: " + location.getLongitude());
    }

Control reached at onStatusChanged but not on onLocationChanged

    @Override
    public void onStatusChanged(String s, int i, Bundle bundle) {
        Log.d("onStatus","0");
    }
};

onResume

@Override
protected void onResume() {
    super.onResume();
    locationManager.requestLocationUpdates(IALocationRequest.create(),locationListener);
}

onPause

@Override
protected void onPause() {

    super.onPause();
    locationManager.removeLocationUpdates(locationListener);
}

onDestroy

@Override
protected void onDestroy() {
    locationManager.destroy();
    super.onDestroy();
}
1

There are 1 answers

0
Jukka Raanamo On BEST ANSWER

There's couple of things that might be the cause starting with:

  • The venue where you are testing in needs to be mapped as described in: http://docs.indooratlas.com/app/
  • Once mapped, a cloud side "magnetic map" needs to be generated as described in Step 3 in the document mentioned above
  • You need to have Android device with atleast Wifi but preferably accelerometer, gyro and magnetometer too
  • Wifi scanning needs to be enabled on your device so enable location services on your device
  • You have setup IndoorAtlas SDK as per described in: http://docs.indooratlas.com/android/getting-started.html

To get started on troubleshooting, print out the arguments on the status callback:

public void onStatusChanged(String s, int i, Bundle bundle) {
        Log.d(LOG_TAG, "onStatusChanged, code: " + i + ", args: " + bundle);
}

And compare the status code against status codes found in: http://docs.indooratlas.com/android/2.2.2/com/indooratlas/android/sdk/IALocationManager.html.

Another thing is to look out for any log statements with tag "IASDK":

adb logcat *:E IASDK:V

There is also rather extensive discussion on the same matter in GitHub: https://github.com/IndoorAtlas/android-sdk-examples/issues/5.

Hope this helps and you can start receiving location updates!