In my project I request marshmallow permissions in fragment after adding permissions onrequestpermissiomResult is not calling in my fragment my code:
public class  @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    profileView = inflater.inflate(R.layout.fragment_profile, container, false);
    server_utilities = new ServerUtilities();
    utilities = new Utilities(getActivity());
    getUserProfileInfo();
    callbackManager = CallbackManager.Factory.create(); 
cameraImageView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ***if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                //First checking if the app is already having the permission
                if (utilities.isReadStorageAllowed(getActivity())) {
                    //If permission is already having then showing the toast
                    Toast.makeText(ctx.getApplicationContext(), "You already have the permission", Toast.LENGTH_LONG).show();
                    //Existing the method with return
                    showFourButtonsBSDialog();
                } else {
                    //If the app has not the permission then ask for the permission
                    utilities.checkPermissions(ctx, getActivity());
                }
            } else
                showFourButtonsBSDialog();***
        }
    });
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                       @NonNull int[] grantResults) {
    switch (requestCode) {
        case REQUEST_PICKIMAGE:
            //If permission is granted
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                //Displaying a toast
                Toast.makeText(MainActivity.this, "Permission granted now you can read the storage", Toast.LENGTH_LONG).show();
                profile_fragment.showFourButtonsBSDialog(); //todo
            } else {
                //Displaying another toast if permission is not granted
                Toast.makeText(MainActivity.this, "Oops you just denied the permission", Toast.LENGTH_LONG).show();
            }
    }
}
How to add marshmallow permissions in fragment of an activity?
 
     
    