opermission/src/main/java/co/omkar/utility/opermission/RequestPermission.java
public void request() {
        mLog.i(TAG, "Requesting.........");
        resultMap = new LinkedHashMap<>(permBean.size());

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
                && isPermissionRequired(permBean)) {

            // if result target is not set use activity as default.
            if (RequestPermission.mBase == null) {
                RequestPermission.mBase = mActivity;
            }
            mLog.i(TAG, "On permission result " + mBase.getClass().getSimpleName()
                    + " class methods will be executed.");

            PermBean bean = new PermBean();
            Map<Permission, String> map = permBean.getPermissions();
            for (Map.Entry<Permission, String> m : map.entrySet()) {
                if (mActivity.checkSelfPermission(m.getKey().toString()) != PackageManager.PERMISSION_GRANTED) {
                    bean.put(m.getKey(), m.getValue());
                    mLog.i(TAG, m.getKey().name() + " requires permission");
                } else {
                    resultMap.put(m.getKey(), Result.GRANTED);
                }
            }

            // ask permissions for granted methods.
            if (bean.size() > 0) {
                showDialog(bean);
            }
        } else {
            for (Map.Entry<Permission, String> m : permBean.getPermissions().entrySet()) {
                resultMap.put(m.getKey(), Result.GRANTED);
            }
            try {
                invokeAnnotatedMethods(resultMap);
            } catch (InvocationTargetException e) {
                mLog.e(TAG, e.getMessage(), e);
            } catch (IllegalAccessException e) {
                mLog.e(TAG, e.getMessage(), e);
            }
            mLog.i(TAG, "request: Redundant");
        }
    }
public void request() {
        mLog.i(TAG, "Requesting.........");
        resultMap = new LinkedHashMap<>(permBean.size());

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
                && isPermissionRequired(permBean)) {

            // if result target is not set use activity as default.
            if (RequestPermission.mBase == null) {
                RequestPermission.mBase = mActivity;
            }
            mLog.i(TAG, "On permission result " + mBase.getClass().getSimpleName()
                    + " class methods will be executed.");

            PermBean bean = new PermBean();
            Map<Permission, String> map = permBean.getPermissions();
            for (Map.Entry<Permission, String> m : map.entrySet()) {
                if (mActivity.checkSelfPermission(m.getKey().toString()) != PackageManager.PERMISSION_GRANTED) {
                    bean.put(m.getKey(), m.getValue());
                    mLog.i(TAG, m.getKey().name() + " requires permission");
                } else {
                    resultMap.put(m.getKey(), Result.GRANTED);
                }
            }

            // ask permissions for granted methods.
            if (bean.size() > 0) {
                showDialog(bean);
            }
        } else {
            for (Map.Entry<Permission, String> m : permBean.getPermissions().entrySet()) {
                resultMap.put(m.getKey(), Result.GRANTED);
            }
            try {
                invokeAnnotatedMethods(resultMap);
            } catch (InvocationTargetException e) {
                mLog.e(TAG, e.getMessage(), e);
            } catch (IllegalAccessException e) {
                mLog.e(TAG, e.getMessage(), e);
            }
            mLog.i(TAG, "request: Redundant");
        }
    }
public void request ( ) { mLog . i ( TAG , "Requesting........." ) ; resultMap = new LinkedHashMap <> ( permBean . size ( ) ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M && isPermissionRequired ( permBean ) ) { // if result target is not set use activity as default. if ( RequestPermission . mBase == null ) { RequestPermission . mBase = mActivity ; } mLog . i ( TAG , "On permission result " + mBase . getClass ( ) . getSimpleName ( ) + " class methods will be executed." ) ; PermBean bean = new PermBean ( ) ; Map < Permission , String > map = permBean . getPermissions ( ) ; for ( Map . Entry < Permission , String > m : map . entrySet ( ) ) { if ( mActivity . checkSelfPermission ( m . getKey ( ) . toString ( ) ) != PackageManager . PERMISSION_GRANTED ) { bean . put ( m . getKey ( ) , m . getValue ( ) ) ; mLog . i ( TAG , m . getKey ( ) . name ( ) + " requires permission" ) ; } else { resultMap . put ( m . getKey ( ) , Result . GRANTED ) ; } } // ask permissions for granted methods. if ( bean . size ( ) > 0 ) { showDialog ( bean ) ; } } else { for ( Map . Entry < Permission , String > m : permBean . getPermissions ( ) . entrySet ( ) ) { resultMap . put ( m . getKey ( ) , Result . GRANTED ) ; } try { invokeAnnotatedMethods ( resultMap ) ; } catch ( InvocationTargetException e ) { mLog . e ( TAG , e . getMessage ( ) , e ) ; } catch ( IllegalAccessException e ) { mLog . e ( TAG , e . getMessage ( ) , e ) ; } mLog . i ( TAG , "request: Redundant" ) ; } }
<p>Execute request for all provided permissions. It checks if permissions
are already granted or required to grant.</p>
<p>Only if only API is greater than 23 (i.e. Marshmallows or later).</p>
<p > Execute request for all provided permissions . It checks if permissions are already granted or required to grant . < / p > <p > Only if only API is greater than 23 ( i . e . Marshmallows or later ) . < / p >