Closed mgolebiowski95 closed 6 years ago
@mgolebiowski95 can you show your onStart
method?
or run this code and change orientation a few times
my requested permisison
You can too add to library method checking android permission dialog is actually showing. In onCreate() bundle savedInstanceState key="android:hasCurrentPermissionsRequest" which contains this value.
I found quite accidentally :-)
@mgolebiowski95 huh that's a cool tip about android:hasCurrentPermissionsRequest
. Thanks!
Can you show the crash logs you're getting? Also is your Activity a descendant of AppCompatActivity
?
I hadn't crash. This is my simple test https://github.com/mgolebiowski95/easypermissionstest. (master, another_idea)
problem: stack rationale dialog
clear application data -> grand first permission, other deny -> close appsetting dialog -> rotate phone a few times / go to background and return to app
clear application data -> grand first permission, other deny -> rotate phone a few times / go to background and return to app (rationale dialog stack under appsetting dialog)
Maybe AppSetting Dialog better create based on DialogFragment. Then can check findFragmentByTag is exists.
With android:hasCurrentPermissionsRequest may be problem. When go to background and return to app onCreate() isn't called (only onStart() and onResume() ) and can not update value hasCurrentPermissionsRequest. (there is no access to savedInstanceState bundle)
@mgolebiowski95 thanks for the code, I can confirm that in your situation the dialog does stack. There are two action items here:
onStart
, the Android UX guidelines for permissions
requests say to show the request in response to a user action (button click, etc)This issue has been fixed and released in version 1.1.2
I have a similar bug in version 1.2.0
and not in 1.1.2
.
Looks like easypermission is keeping reference to the Fragment after rotation
But I don't get why if I rotate only once, it doesn't crash.
Basic Information
Device type: ____ OS version: ____ EasyPermissions version: 1.0.1
Describe the problem
What happened? What did you expect to happen?
When I executed code below code 0 in onStart() every time show new rationale dialog over previous dialog. If dialog is exist new dialog should'nt show. A good solution would be to add a method that checks whether or not a rationale dialog is shown code 1 and code 2
Code and logs
code 0: EasyPermissions.requestPermissions(this, "To function properly, App needs your permissions. Allow permissions for App", RC_REQUIRED_PERM, REQUESTED_PERMISSIONS_ON_START);
code 1:
code 2:
// TODO(you): show the code that produces the problem, execute code 0 in onStart() ex. go to background and returning to application more than 1 time