yayaa / LocationManager

Simplify getting user's location for Android
806 stars 187 forks source link

NullPointerException in DefaultLocationProvider.java:249 #33

Closed ghost closed 7 years ago

ghost commented 7 years ago

com.yayandroid.locationmanager.provider.DefaultLocationProvider$3.onLocationChanged (DefaultLocationProvider.java:249)

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.yayandroid.locationmanager.LocationConfiguration.shouldKeepTracking()' on a null object reference at com.yayandroid.locationmanager.provider.DefaultLocationProvider$3.onLocationChanged(DefaultLocationProvider.java:249) at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:285) at android.location.LocationManager$ListenerTransport.-wrap0(LocationManager.java) at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:230) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5421) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

at line 249 if (configuration.shouldKeepTracking()) { requestUpdateLocation(configuration.getRequiredTimeInterval(), false); } else { locationManager.removeUpdates(locationChangeListener); }

yayaa commented 7 years ago

Can you please provide your configuration and the usecase how this happens? Because in normal locationListener should've been removed already.

ghost commented 7 years ago

Thanks.

Constants.TIME_UPDATE_GPS= 1800

@Override public LocationConfiguration getLocationConfiguration() { return new LocationConfiguration() .keepTracking(true) .askForSettingsApi(false) .askForEnableGPS(false) .askForGooglePlayServices(false) .setMinAccuracy(200.0f) //aggiorna posizione ogni 30 min .setWaitPeriod(ProviderType.GOOGLE_PLAY_SERVICES, Constants.TIME_UPDATE_GPS 1000) .setWaitPeriod(ProviderType.GPS, Constants.TIME_UPDATE_GPS 1000) .setWaitPeriod(ProviderType.NETWORK, Constants.TIME_UPDATE_GPS * 1000) ; }

2017-03-22 17:46 GMT+01:00 Yahya Bayramoğlu notifications@github.com:

Can you please provide your configuration and the usecase how this happens? Because in normal locationListener should've been removed already.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/yayaa/LocationManager/issues/33#issuecomment-288462692, or mute the thread https://github.com/notifications/unsubscribe-auth/ADCEcyatRkHNSAp9uNcEmisKxIf4RUY_ks5roVBwgaJpZM4Mk_nE .

yayaa commented 7 years ago

I still need the usecase @patler i need steps to follow up to get this error, because as i said in normal behaviour this should not happen. I need to be able reproduce this, in order to figure out the reason and fix. By the way, please also consider to use v2.0.0 which is just released :)

ghost commented 7 years ago

Fixed with v2.0.0