{"id":17153700,"url":"https://github.com/vinodbaste/permission_handler","last_synced_at":"2026-02-12T13:17:51.338Z","repository":{"id":184876148,"uuid":"565204224","full_name":"vinodbaste/permission_handler","owner":"vinodbaste","description":"On most operating systems, permissions aren't just granted to apps at install time. Rather, developers have to ask the user for permissions while the app is running. This plugin provides a API to request permissions and check their status.","archived":false,"fork":false,"pushed_at":"2022-11-13T14:28:16.000Z","size":164,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T03:51:15.599Z","etag":null,"topics":["android","android-permissions","googledevelopers","jitpack-library","library","permissions","permissions-android","runtime-permissions"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vinodbaste.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-11-12T16:59:20.000Z","updated_at":"2023-10-25T10:42:41.000Z","dependencies_parsed_at":"2023-07-30T18:37:37.240Z","dependency_job_id":null,"html_url":"https://github.com/vinodbaste/permission_handler","commit_stats":null,"previous_names":["vinodbaste/permission_handler"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpermission_handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpermission_handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpermission_handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vinodbaste%2Fpermission_handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vinodbaste","download_url":"https://codeload.github.com/vinodbaste/permission_handler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248717240,"owners_count":21150387,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","android-permissions","googledevelopers","jitpack-library","library","permissions","permissions-android","runtime-permissions"],"created_at":"2024-10-14T21:47:02.782Z","updated_at":"2026-02-12T13:17:46.319Z","avatar_url":"https://github.com/vinodbaste.png","language":"Java","funding_links":["https://www.buymeacoffee.com/bastevinod"],"categories":[],"sub_categories":[],"readme":"# permission_handler\nOn most operating systems, permissions aren't just granted to apps at install time. Rather, developers have to ask the user for permissions while the app is running. \n\nThis plugin provides a API to request permissions and check their status. You can also open the device's app settings so users can grant a permission.\nand you can show a rationale for requesting a permission.\n\n[![API](https://img.shields.io/badge/API-26%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=26)\n[![GitHub tag](https://img.shields.io/github/tag/vinodbaste/image-compressor?include_prereleases=\u0026sort=semver\u0026color=blue)](https://github.com/vinodbaste/image-compressor/releases/)\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue)](#license)\n[![News - Android Weekly](https://img.shields.io/badge/News-Android_Weekly-d36f21)](https://androidweekly.net/issues/issue-326)\n[![Story - Medium](https://img.shields.io/badge/Story-Medium-2ea44f)](https://medium.com/codex/image-compressor-13dbfd0445a3)\n[![GitHub - VinodBaste](https://img.shields.io/badge/GitHub-VinodBaste-4664c6)](https://github.com/vinodbaste/permission_handler)\n\n\u003cimg src = \"https://github.com/vinodbaste/permission_handler/blob/main/screenshots/Screenshot_20221113_131102.png\" width = 250 height = 500 /\u003e\n\n# How to implement\nTo get a Git project into your build:\n## Gradle\n` Step 1:` Add it in your **root build.gradle**  at the end of repositories:\n```java\nallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n```\n\n`Step 2:` Add the dependency in your **project build.gradle**\n```java\ndependencies {\n    implementation 'com.github.vinodbaste:permission_handler:1.0.0'\n}\n```\n\n# Usage:\n------\n\nFirst declare your permissions in the manifest file.\nExample:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.CAMERA\" /\u003e\n```\n\n## Single permission\nPass the permission you want to request.\n```java\nPermissionsHandler.requestPermission(this, Manifest.permission.CALL_PHONE, null, new PermissionHandler() {\n@Override\npublic void onPermissionGranted() {\n        Toast.makeText(MainActivity.this, \"Phone granted.\", Toast.LENGTH_SHORT).show();\n        }\n});\n```\n\n## Multiple permissions\npass multiple requests in a list\n```java\nString[] permissions = {Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE};\n        PermissionsHandler.requestPermission(this,permissions, null, new PermissionHandler() {\n@Override\npublic void onPermissionGranted() {\n        Toast.makeText(MainActivity.this, \"Permissions granted.\", Toast.LENGTH_SHORT).show();\n        }\n});\n```\n\n## override methods\n**onPermissionGranted:**\nThis override method is called after all the permissions are granted by the user.\n```java\npublic void onPermissionGranted(){\n        Toast.makeText(MainActivity.this,\"Permissions granted.\",Toast.LENGTH_SHORT).show();\n        }\n```\n\n**onPermissionDenied:**\nThis override method is called when any of the permission is denied by the user.\n```java\n @Override\npublic void onPermissionDenied(Context context, ArrayList\u003cString\u003e deniedPermissions) {\n        Toast.makeText(MainActivity.this, \"Location denied.\", Toast.LENGTH_SHORT).show();\n        }\n```\n\n**onPermissionDeniedOnce:**\nThis override method is called when any of the permission is denied by the user once or on the first time of the permisssion promt window is displayed.\n```java\n@Override\npublic void onPermissionDeniedOnce(Context context, ArrayList\u003cString\u003e justBlockedList, ArrayList\u003cString\u003e deniedPermissions) {\n        super.onPermissionDeniedOnce(context, justBlockedList, deniedPermissions);\n\n        Log.e(\"onJustPermissions1\", justBlockedList.toString());\n        Log.e(\"onJustPermissions2\", deniedPermissions.toString());\n        }\n```\n\n**onPermissionNeverAskAgain:**\nThis override method is called when any of the permission is denied perminentaly by the user.\n```java\n @Override\npublic boolean onPermissionNeverAskAgain(Context context, ArrayList\u003cString\u003e blockedList) {\n        return super.onPermissionNeverAskAgain(context, blockedList);\n        }\n```\n# Note\n```\nOn permanent deny of any permission requested, navigating to application settings to enable the permanent denied permission promt is enabled by default.\n```\n\n## Customized permissions request\nyou can customize the permission request by using `options`.\n* **rationale:** short message for why the permission is needed.\n* **setRationaleDialogTitle:** title for rational dialog.\n* **setSettingsDialogTitle:** title for settings dialog.\n```java\nString[] permissions = {Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION};\n        String rationale = \"Please provide location permission so that you can ...\";\n        PermissionsHandler.Options options = new PermissionsHandler.Options()\n        .setRationaleDialogTitle(\"Info\")\n        .setSettingsDialogTitle(\"Warning\");\n\n        PermissionsHandler.requestPermission(this, permissions, rationale, options, new PermissionHandler() {\n@Override\npublic void onPermissionGranted() {\n        Toast.makeText(MainActivity.this, \"Location granted.\", Toast.LENGTH_SHORT).show();\n        }\n\n@Override\npublic void onPermissionDenied(Context context, ArrayList\u003cString\u003e deniedPermissions) {\n        Toast.makeText(MainActivity.this, \"Location denied.\", Toast.LENGTH_SHORT).show();\n        }\n        });\n\t\n```\n\n**If you find this library useful, please consider starring this repository from the top of this page.**\n[![](https://i.imgur.com/oSLuE0e.png)](#)\n\n# Support my work\n\u003ca href=\"https://www.buymeacoffee.com/bastevinod\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n\n# License\n```\nCopyright [2022] [Vinod Baste]\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinodbaste%2Fpermission_handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvinodbaste%2Fpermission_handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvinodbaste%2Fpermission_handler/lists"}