-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
I'm trying to display a DialogFragment when the permissions are denied, to let the user know that they need to accept them before they can continue further into the app.
I have this in onCreate
Permiso.getInstance().requestPermissions(new Permiso.IOnPermissionResult() {
@Override
public void onPermissionResult(Permiso.ResultSet resultSet) {
if (!resultSet.areAllPermissionsGranted()) {
final ConfirmDialog confirmDialog = ConfirmDialog.newInstance(R.string.permission_title, R.string.permission_text);
confirmDialog.show(getSupportFragmentManager(), ConfirmDialog.TAG);
} else {
//We're good to go!
performSetup();
}
}
@Override
public void onRationaleRequested(Permiso.IOnRationaleProvided callback, String...
permissions) {
callback.onRationaleProvided();
}
}, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.WRITE_EXTERNAL_STORAGE);
And get this every time:
java.lang.RuntimeException: Failure delivering result ResultInfo{who=@android:requestPermissions:, request=1, result=-1, data=Intent { act=android.content.pm.action.REQUEST_PERMISSIONS (has extras) }} to activity {com.shortlister.app/com.shortlister.app.presentation.ui.interview.live.InterviewActivity}: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.app.ActivityThread.deliverResults(ActivityThread.java:3699)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1489)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1507)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
at android.support.v4.app.DialogFragment.show(DialogFragment.java:139)
at com.shortlister.app.presentation.ui.interview.base.BaseInterviewActivity$1.onPermissionResult(BaseInterviewActivity.java:85)
at com.greysonparrelli.permiso.Permiso.onRequestPermissionResult(Permiso.java:153)
at com.shortlister.app.presentation.ui.common.BaseActivity.onRequestPermissionsResult(BaseActivity.java:113)
at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6553)
at android.app.Activity.dispatchActivityResult(Activity.java:6432)
at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742)
at android.app.ActivityThread.-wrap16(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
ConfirmDialog is a subclass of android.support.v4.app.DialogFragment, if I use android.app.DialogFragment there is no issue so I'm assuming it's a problem with the support library.
Here's the issue I came across when trying to fix it:
https://code.google.com/p/android-developer-preview/issues/detail?id=2823
Let me know if this is something I'm doing as opposed to an issue with your library.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels