Skip to content

Fix blink screen on start app #1428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Fix blink screen on start app #1428

wants to merge 1 commit into from

Conversation

kolomboss
Copy link

Fix blink screen on start app if one of the permissions was rejected and "Never ask again" button was pressed.

Problem:
If one of the permissions (READ_CONTACTS or WRITE_EXTERNAL_STORAGE) was rejected by the user and user pressed the button "Never ask again", then after that, screen start to blink after start application.

Сause:
It happens because one of the functions shouldShowRequestPermissionRationale in onResume methode in ui/DialogsActivity.java returns false and else statement call askForPermissons() function where all permissions put in one List and immediately requesting. Android trying to request blocked permission (blocked by the user with "never ask again" button), and this cause screen blink.

if (activity.checkSelfPermission(Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED || activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
    if (activity.shouldShowRequestPermissionRationale(Manifest.permission.READ_CONTACTS)) {
         //showDialog
     } else if (activity.shouldShowRequestPermissionRationale(Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
         //showDialog
     } else {
         askForPermissons();
     }
}

Solution:
Request permissions only if this permission not granted and not "Never ask again" button pressed.

I wrote small helper class with static functions. Sorry, i dont know in which one of the packages I can placed it.
This class created for using your requests with other you permissions.
Thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant