Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 671 forks source link

Permissions dialog not working in fragment #227

Closed sathishmscict closed 4 years ago

sathishmscict commented 5 years ago

Expected behaviour

Actual behaviour

Steps to reproduce

MainActivity permission allow then replace a fragment in activity. From fragment location permission checked with Dexter permission allow dialogue not appeared.

Dexter.withActivity(getActivity())
                    .withPermissions(
                            Manifest.permission.ACCESS_COARSE_LOCATION,
                            Manifest.permission.ACCESS_FINE_LOCATION
                    ).withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    /* ... */

                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                    /* ... */
                    // token.continuePermissionRequest();
                }
            }).check();

Version of the library

Papashkin commented 5 years ago

@sathishmscict I'm using this library in fragments and seems it works ok. I use Dexter like the following code: vButtonCamera.setOnClickListener { Dexter.withActivity(this.activity) .withPermission(Manifest.permission.CAMERA) .withListener(permissionListener) .check() }

I'm just using Kotlin instead Java, but this.activity in Kotlin is the same as this.getActivity() in Java.

PalakSDarji commented 5 years ago

happens to me too..

pedrovgs commented 4 years ago

@sathishmscict @PalakSDarji can you please fill the issue template properly? We need to know the expected behavior, the behavior you are facing, and the version of the library you are using to be able to understand what's going on. If you could also create an example project on GitHub reproducing the error, that'd be awesome 😃

chihung93 commented 4 years ago

@pedrovgs : happens to me too...Its happen on Samsung devices My device: Samsung S6 edge, etc

pedrovgs commented 4 years ago

@chihung93 could you please upload any android project reproducing the issue in a simple example? Just a simple empty app where you can reproduce the issue. I'm trying to reproduce it in a new project, but there must be something I'm missing.

chihung93 commented 4 years ago

@chihung93 : nope, I don't have time to do this anymore, Some device don't get this issue, but Samsung always get this problem.... It's only happening on Fragment and using Samsung device.

chihung93 commented 4 years ago

My code is the same @sathishmscict , but I have this line token.continuePermissionRequest();

Dexter.withActivity(getActivity())
                    .withPermissions(
                            Manifest.permission.ACCESS_COARSE_LOCATION,
                            Manifest.permission.ACCESS_FINE_LOCATION
                    ).withListener(new MultiplePermissionsListener() {
                @Override
                public void onPermissionsChecked(MultiplePermissionsReport report) {
                    /* ... */

                }

                @Override
                public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {
                    /* ... */
                    token.continuePermissionRequest();
                }
            }).check();
pedrovgs commented 4 years ago

Only happening on Samsung devices @chihung93 ? I don't have any Samsung device to fix this issue at all. Could some external collaborators help us with this? We should first check how to reproduce the error.

mskn73 commented 4 years ago

I am using dexter in a fragment and it is working in Galaxy S8 (G950F) with android 9. I am not sure if it fails in older Samsung devices. Also I tested with simple and multiple permissions.

kojofosu commented 4 years ago

It works in my fragment class too...using a samsung s8 device

pedrovgs commented 4 years ago

As we have two confirmations from different years of the library working in Samsung devices I'm closing the issue. Thank you all for your comments and help 😃

pisxid commented 3 years ago

As we have two confirmations from different years of the library working in Samsung devices I'm closing the issue. Thank you all for your comments and help 😃

If it helps, for some reason you need to uninstall, recompile and install the app.