mrmans0n/smart-location-lib

Still does not prompt dialogue when set to true

Opened this issue · 1 comments

/**
     * Sets whether or not we should request (before starting updates) the availability of the
     * location settings and act upon it.
     *
     * @param allowingLocationSettings TRUE to show the dialog if needed, FALSE otherwise (default)
     */
    public void setCheckLocationSettings(boolean allowingLocationSettings) {
        this.checkLocationSettings = allowingLocationSettings;
    }

Still does not prompt dialogue when set to true.

Am using the sample code.

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