mrmans0n/smart-location-lib

Location settings are not satisfied!

Closed this issue · 1 comments

The code that I wrote yesterday was working perfectly but suddenly it started to give this:

Location settings are not satisfied. Show the user a dialog to upgrade location settings. You should hook into the Activity onActivityResult and call this provider's onActivityResult method for continuing this call flow. Provided context is not the context of an activity, therefore we can't launch the resolution activity.

Im almost sure that Im asking and granting requested permissions. Like I said, It was working yesterday. Im using the same code that given in sample using Kotlin Language.

Basically you can not show Location Settings if not init SmartLocation using Activity Context, because the Dialog only show if context is instance of Activity as shown below..

if (context instanceof Activity) { try { // Show the dialog by calling startResolutionForResult(), and check the result // in onActivityResult(). status.startResolutionForResult((Activity) context, REQUEST_CHECK_SETTINGS); } catch (IntentSender.SendIntentException e) { logger.i("PendingIntent unable to execute request."); } } else { logger.w("Provided context is not the context of an activity, therefore we can't launch the resolution activity."); }

This snippet from
https://github.com/mrmans0n/smart-location-lib/blob/master/library/src/main/java/io/nlopez/smartlocation/location/providers/LocationGooglePlayServicesProvider.java