app/src/main/java/fr/free/nrw/commons/location/LocationServiceManager.java
public boolean isPermissionExplanationRequired(Activity activity) {
        if (activity.isFinishing()) {
            return false;
        }
        boolean showRequestPermissionRationale = ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION);
        if (showRequestPermissionRationale && !locationExplanationDisplayed.contains(activity)) {
            locationExplanationDisplayed.add(activity);
            return true;
        }
        return false;
    }
/**
     * The permission explanation dialog box is now displayed just once for a particular activity. We are subscribing
     * to updates from multiple providers so its important to show the dialog just once. Otherwise it will be displayed
     * once for every provider, which in our case currently is 2.
     * @param activity
     * @return
     */
The permission explanation dialog box is now displayed just once for a particular activity. We are subscribing
to updates from multiple providers so its important to show the dialog just once. Otherwise it will be displayed
once for every provider, which in our case currently is 2.
@param activity
@return
The permission explanation dialog box is now displayed just once for a particular activity . We are subscribing to updates from multiple providers so its important to show the dialog just once . Otherwise it will be displayed once for every provider which in our case currently is 2 . @param activity @return
public boolean isPermissionExplanationRequired(Activity activity) {
        if (activity.isFinishing()) {
            return false;
        }
        boolean showRequestPermissionRationale = ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.ACCESS_FINE_LOCATION);
        if (showRequestPermissionRationale && !locationExplanationDisplayed.contains(activity)) {
            locationExplanationDisplayed.add(activity);
            return true;
        }
        return false;
    }
public boolean isPermissionExplanationRequired ( Activity activity ) { if ( activity . isFinishing ( ) ) { return false ; } boolean showRequestPermissionRationale = ActivityCompat . shouldShowRequestPermissionRationale ( activity , Manifest . permission . ACCESS_FINE_LOCATION ) ; if ( showRequestPermissionRationale && ! locationExplanationDisplayed . contains ( activity ) ) { locationExplanationDisplayed . add ( activity ) ; return true ; } return false ; }
The permission explanation dialog box is now displayed just once for a particular activity.
The permission explanation dialog box is now displayed just once for a particular activity .