androidgoogle-mapsgeolocationlocationgoogle-indoor-maps

Can't get lat long using IndoorAtlas sdk in android


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

Solution

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

    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!