Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

after denied permission i get this error(In Fragment) #133

Closed
rezaiyan opened this issue Jun 19, 2017 · 4 comments
Closed

after denied permission i get this error(In Fragment) #133

rezaiyan opened this issue Jun 19, 2017 · 4 comments

Comments

@rezaiyan
Copy link

rezaiyan commented Jun 19, 2017

`

FATAL EXCEPTION: main

Process: co.iliasystem.akbarjoojeh, PID: 7204
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1842)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1860)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:650)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:609)
at android.support.v4.app.DialogFragment.show(DialogFragment.java:143)
at ir.droidhub.permissionhelper.helper.BaseSupportPermissionsHelper.showRequestPermissionRationale(BaseSupportPermissionsHelper.java:30)
at ir.droidhub.permissionhelper.helper.PermissionHelper.requestPermissions(PermissionHelper.java:73)
at ir.droidhub.permissionhelper.EasyPermissions.requestPermissions(EasyPermissions.java:184)
at ir.droidhub.permissionhelper.EasyPermissions.requestPermissions(EasyPermissions.java:155)
at ir.droidhub.permissionhelper.EasyPermissions.requestPermissions(EasyPermissions.java:110)
at co.iliasystem.akbarjoojeh.fragment.PayFragment.smsTask(PayFragment.java:313)
at co.iliasystem.akbarjoojeh.fragment.PayFragment.access$400(PayFragment.java:54)
at co.iliasystem.akbarjoojeh.fragment.PayFragment$3.onClick(PayFragment.java:284)
at com.hamirt.hamidialog.materialdialogs.MaterialDialog.onClick(MaterialDialog.java:337)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)

  at java.lang.reflect.Method.invoke(Native Method)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

`

@samtstern
Copy link
Contributor

@rezaiyan what version of the library are you using?

@madhanmallow
Copy link

madhanmallow commented Jun 21, 2017

The issue also happens to me. I used the version compile 'pub.devrel:easypermissions:0.4.2'
My code is

   public void onPermissionsDenied(int requestCode, List<String> perms) {
       if (EasyPermissions.somePermissionPermanentlyDenied(this, perms)) {
           promptLocationSettings();
       } else {
           EasyPermissions.requestPermissions(this, getString(R.string.need_location_permission), REQUEST_CODE_LOCATION_PERMISSION, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION);
       }
   }```


Got error in else part.

@SUPERCILEX
Copy link
Contributor

@madhanmallow See #150 (comment), it looks like it could be the same issue. It could also be that you're not calling super.onActivityResult(...) in your activity. Though looking at your stack trace, I don't understand how it relates to the code you posted. It looks like you're trying to request the permissions from a dialog that's trying to close itself which would explain the state loss. I could try to help some more with additional info! 😄

PS: looping the permission request infinitely until the user accepts your permission isn't the best UX. 😄

@samtstern
Copy link
Contributor

Since it's been a long time since the last response by @madhanmallow (my fault for not getting back after the Jun 21 comment) and this is likely a duplicate, let's call this a duplicate of #150 and move discussion over there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants