smart-location-lib
smart-location-lib copied to clipboard
onLocationUpdated not called in service
I use this library inside a service, the service extends OnLocationUpdatedListener so I am able to request updates like this:
SmartLocation.with(getApplicationContext()).location().config(LocationParams.NAVIGATION).start(this)
The issue is very strange as my code works on some phone but not on other. On those that does not work I am able to tell that the service did indeed start but onLocationUpdated is never called (GPS is on).
Might that have to do with permission request? I have
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
in my manifest. But as of Android run time permission maybe I need to request it explicitly or something?
If you make an application for Android Marshmallow and above (api >23) you should request for permissions to the user. See the official docs for learning how to do that.
It is true. I requested permission before calling the library and it worked!
Would be nice if the library included this check too!