Code Monkey home page Code Monkey logo

Comments (12)

samtstern avatar samtstern commented on September 28, 2024

@vipulasri I don't quite understand your issue, can you post some code that reproduces the problem?

from easypermissions.

vipulasri avatar vipulasri commented on September 28, 2024

@samtstern I mean I am asking two different permissions on two different activities or fragments but as soon as first activity asks for a permission only related to that activity (Ex. Send OTP screen asks for READ_SMS) then another permission (i.e WRITE_EXTERNAL_STORAGE) on another activity and that screen is not yet called or displayed. Still, after allowing first READ_SMS permission, it asks for second permission WRITE_EXTERNAL_STORAGE.

@Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        EasyPermissions.onRequestPermissionsResult(requestCode, permissions, grantResults, this);
    }

Do I have to change onRequestPermissionResult() method calling super?

from easypermissions.

samtstern avatar samtstern commented on September 28, 2024

@vipulasri so you have two fragments in the same Activity requesting different permissions? Where do you actually call reuestPermissions?

from easypermissions.

vipulasri avatar vipulasri commented on September 28, 2024

@samtstern No, I have one request permission in a fragment associated with another activity and second request permission in a different activity. I call to request permission in both activities not associated with each other.

from easypermissions.

samtstern avatar samtstern commented on September 28, 2024

@vipulasri please show me how you are requesting the SMS permission.

from easypermissions.

vipulasri avatar vipulasri commented on September 28, 2024
@AfterPermissionGranted(RC_READ_SMS_PERM)
    public void initiateOtp() {
        if (EasyPermissions.hasPermissions(getActivity(), Manifest.permission.READ_SMS)) {
            initiateVerification();
        } else {
            EasyPermissions.requestPermissions(this, getString(R.string.readsms_permission), RC_READ_SMS_PERM, Manifest.permission.READ_SMS);
        }
    }

from easypermissions.

samtstern avatar samtstern commented on September 28, 2024

And where do you request the external storage permission? I need some context with these code snippets, the behavior you're describing is guaranteed to be some strange issue in how your code is set up so only showing me basic code will not get to the root of the problem.

from easypermissions.

vipulasri avatar vipulasri commented on September 28, 2024

I request the external storage permission(if not permitted), whenever the user has to select a picture from the device and upload it. And request external storage permission is implemented in BaseActivity so that I can reuse the feature when needed.

from easypermissions.

samtstern avatar samtstern commented on September 28, 2024

Are you re-using the same request code for each (RC_READ_SMS_PERM)? Try using different request codes in the requestPermissions and @AfterPermissionGranted annotations.

from easypermissions.

vipulasri avatar vipulasri commented on September 28, 2024

I am already using different request codes for both permission requests.

from easypermissions.

samtstern avatar samtstern commented on September 28, 2024

@vipulasri I am going to need to see more code to debug, there has not been enough information provided in this thread to lead to the source of the problem. If you'd prefer this can be done on StackOverflow.

from easypermissions.

vipulasri avatar vipulasri commented on September 28, 2024

@samtstern I figured out the problem. Problem was I was having external storage permission in my base activity and the activity which was requiring permission for read sms was extending BaseActivity which was creating issue as onRequestPermissionsResult was calling its super method thus calling base activity onRequestPermissionsResult.

from easypermissions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.