public static boolean isLocationPermissionDeniedForever(final Activity activity) {
        final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);

        return !isLocationPermissionsGranted(activity) // Location permission must be denied
                && preferences.getBoolean(PREFS_PERMISSION_REQUESTED, false) // Permission must have been requested before
                && !ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION); // This method should return false
    }
Returns true if location permission has been requested at least twice and
user denied it, and checked 'Don't ask again'.

@param activity the activity
@return true if permission has been denied and the popup will not come up any more, false otherwise
app/src/main/java/no/nordicsemi/android/nrfmesh/utils/Utils.java