{"action":"opened","issue":{"url":"https://api.github.com/repos/Karumi/Dexter/issues/223","repository_url":"https://api.github.com/repos/Karumi/Dexter","labels_url":"https://api.github.com/repos/Karumi/Dexter/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/Karumi/Dexter/issues/223/comments","events_url":"https://api.github.com/repos/Karumi/Dexter/issues/223/events","html_url":"https://github.com/Karumi/Dexter/issues/223","id":378417683,"node_id":"MDU6SXNzdWUzNzg0MTc2ODM=","number":223,"title":"Permission dialog isn't shown after turning off the premission manually","user":{"login":"burekas7","id":13424257,"node_id":"MDQ6VXNlcjEzNDI0MjU3","avatar_url":"https://avatars2.githubusercontent.com/u/13424257?v=4","gravatar_id":"","url":"https://api.github.com/users/burekas7","html_url":"https://github.com/burekas7","followers_url":"https://api.github.com/users/burekas7/followers","following_url":"https://api.github.com/users/burekas7/following{/other_user}","gists_url":"https://api.github.com/users/burekas7/gists{/gist_id}","starred_url":"https://api.github.com/users/burekas7/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/burekas7/subscriptions","organizations_url":"https://api.github.com/users/burekas7/orgs","repos_url":"https://api.github.com/users/burekas7/repos","events_url":"https://api.github.com/users/burekas7/events{/privacy}","received_events_url":"https://api.github.com/users/burekas7/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-07T18:39:37Z","updated_at":"2018-11-07T18:39:37Z","closed_at":null,"author_association":"NONE","body":"Background:\r\n1. The Dexter is a fragment inside ViewPager inside the main activity.\r\n2. Requesting for \"Locations\" permissions.\r\n\r\nScenarios:\r\n1. [OK] On the first time the app is running, Location is disabled, the dialog is shown up (onPermissionsChecked is activate and confirm the dialog does the work)\r\n\r\n2. [OK] In the second time opening the app, Location is already enabled, dialog isn't shown up as it should be, and everything is ok.\r\n\r\n3. [The problem] While the app is still running and I turn off the Location permission, when checking the permissions the \"onPermissionRationaleShouldBeShown\" is activate.\r\na. Why the dialog isn't shown up again?\r\nb. Why it goes to \"onPermissionRationaleShouldBeShown\" callback?\r\n\r\n4. [Still relates to the problem] In this callback I'm opening the permissions screen of my app, there I'm turn on the Location permission, and then press 'Back' until I return to the app, when checking the permissions again, non of the callbacks is called, neither \"onPermissionsChecked\" nor \"onPermissionRationaleShouldBeShown\".\r\nWhy?\r\n\r\n5. [OK] Only when I clear the data of the app or reinstall it again, the dialog is shown as in (1).  \r\n\r\n\r\n### Version of the library\r\n5.0.0\r\n\r\n### Code\r\n```\r\n    private void registerLocationUpdates() {\r\n        Dexter.withActivity(getActivity())\r\n                .withPermissions(Manifest.permission.ACCESS_COARSE_LOCATION,\r\n                                 Manifest.permission.ACCESS_FINE_LOCATION)\r\n                .withListener(new MultiplePermissionsListener() {\r\n                    @Override public void onPermissionsChecked(MultiplePermissionsReport report) {\r\n                        // check if all permissions are granted\r\n                        if (report.areAllPermissionsGranted()) {\r\n                            getMyLocation();\r\n                        }\r\n                        // check for permanent denial of any permission\r\n                        if (report.isAnyPermissionPermanentlyDenied()) {\r\n                            // permission is denied permenantly, navigate user to app settings\r\n                        }\r\n                    }\r\n                    @Override public void onPermissionRationaleShouldBeShown(List<PermissionRequest> permissions, PermissionToken token) {\r\n                        showSettingsDialog();\r\n                    }\r\n                }).check();\r\n    }\r\n\r\n    /**\r\n     * Showing Alert Dialog with Settings option\r\n     * Navigates user to app settings\r\n     * NOTE: Keep proper title and message depending on your app\r\n     */\r\n    private void showSettingsDialog() {\r\n        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());\r\n        builder.setTitle(\"Need Permissions\");\r\n        builder.setMessage(\"This app needs permission to use this feature. You can grant them in app settings.\");\r\n        builder.setPositiveButton(\"GOTO SETTINGS\", new DialogInterface.OnClickListener() {\r\n            @Override\r\n            public void onClick(DialogInterface dialog, int which) {\r\n                dialog.cancel();\r\n                openSettings();\r\n            }\r\n        });\r\n        builder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\r\n            @Override\r\n            public void onClick(DialogInterface dialog, int which) {\r\n                dialog.cancel();\r\n            }\r\n        });\r\n        builder.show();\r\n\r\n    }\r\n\r\n    // navigating user to app settings\r\n    private void openSettings() {\r\n        Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);\r\n        Uri uri = Uri.fromParts(\"package\", MyApp.getContext().getPackageName(), null);\r\n        intent.setData(uri);\r\n        startActivityForResult(intent, 101);\r\n    }\r\n```"}}
{"actor":{"display_login":"burekas7"}}