yayaa / LocationManager

Simplify getting user's location for Android
807 stars 186 forks source link

Firebase reports: Fatal Exception: java.lang.SecurityException #121

Closed andreabellitto closed 2 years ago

andreabellitto commented 3 years ago

Firebase reports this Exception from some of my field applications Fatal Exception: java.lang.SecurityException

Obviously I have the FINE_LOCATION permission request in application Manifest

Configuration

return LocationConfiguration.Builder()
            .keepTracking(true)
            .useGooglePlayServices(
                GooglePlayServicesConfiguration.Builder().askForSettingsApi(false).build()
            )
            .useDefaultProviders(DefaultProviderConfiguration.Builder().build())
            .build()

Logs

android.os.Parcel.createException (Parcel.java:1966) android.os.Parcel.readException (Parcel.java:1934) android.os.Parcel.readException (Parcel.java:1884) android.location.ILocationManager$Stub$Proxy.getLastLocation (ILocationManager.java:969) android.location.LocationManager.getLastKnownLocation (LocationManager.java:1443) com.yayandroid.locationmanager.providers.locationprovider.DefaultLocationSource.getLastKnownLocation (DefaultLocationSource.java:37) com.yayandroid.locationmanager.providers.locationprovider.DefaultLocationProvider.checkForLastKnowLocation (DefaultLocationProvider.java:155) com.yayandroid.locationmanager.providers.locationprovider.DefaultLocationProvider.askForLocation (DefaultLocationProvider.java:138) com.yayandroid.locationmanager.providers.locationprovider.DefaultLocationProvider.get (DefaultLocationProvider.java:98) com.yayandroid.locationmanager.providers.locationprovider.DispatcherLocationProvider.continueWithDefaultProviders (DispatcherLocationProvider.java:228) com.yayandroid.locationmanager.providers.locationprovider.DispatcherLocationProvider.runScheduledTask (DispatcherLocationProvider.java:85) com.yayandroid.locationmanager.helper.continuoustask.ContinuousTask.run (ContinuousTask.java:46) android.os.Handler.handleCallback (Handler.java:873) android.os.Handler.dispatchMessage (Handler.java:99) android.os.Looper.loop (Looper.java:214) android.app.ActivityThread.main (ActivityThread.java:7050) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)

Caused by android.os.RemoteException Remote stack trace: at com.android.server.LocationManagerService.checkResolutionLevelIsSufficientForProviderUse(LocationManagerService.java:2066) at com.android.server.LocationManagerService.getLastLocation(LocationManagerService.java:2922) at android.location.ILocationManager$Stub.onTransact(ILocationManager.java:159) at android.os.Binder.execTransact(Binder.java:739)

yayaa commented 2 years ago

It seems like the error is thrown by the LocationManager in framework and looking at the API documentation for getLastKnowLocation having Manifest.permission.ACCESS_FINE_LOCATION defined in the manifest should prevent getting the security exception. I'll close this as it doesn't seem to be related to this library, I'd recommend checking on stackoverflow - feel free to reopen it if you were able to identify that is related to this library.