{"id":15316686,"url":"https://github.com/albert-gao/permissionk","last_synced_at":"2026-01-29T00:03:42.605Z","repository":{"id":129076428,"uuid":"131577429","full_name":"Albert-Gao/PermissionK","owner":"Albert-Gao","description":"Opinionated Android permission handling done right with Kotlin.","archived":false,"fork":false,"pushed_at":"2018-04-30T09:31:26.000Z","size":8,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-03T13:06:19.818Z","etag":null,"topics":["android","kotlin","library","permission-android","permissions"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Albert-Gao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-30T09:26:35.000Z","updated_at":"2022-03-26T14:37:10.000Z","dependencies_parsed_at":"2023-03-30T10:04:43.460Z","dependency_job_id":null,"html_url":"https://github.com/Albert-Gao/PermissionK","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"69d43bd0055166162ced34cedf4176ffd8f033d7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Albert-Gao/PermissionK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2FPermissionK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2FPermissionK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2FPermissionK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2FPermissionK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Albert-Gao","download_url":"https://codeload.github.com/Albert-Gao/PermissionK/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Albert-Gao%2FPermissionK/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28856911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"ssl_error","status_checked_at":"2026-01-28T22:56:00.861Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","kotlin","library","permission-android","permissions"],"created_at":"2024-10-01T08:54:40.057Z","updated_at":"2026-01-29T00:03:42.591Z","avatar_url":"https://github.com/Albert-Gao.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PermissionK\n\nOpinionated permission handling done right with Kotlin.\n\nCheck more details in my [blog](http://www.albertgao.xyz/2018/04/23/android-permission-handling-done-right-with-kotlin/)\n\n## Why use it\n\n- The whole flow has been sorted out.\n- Multiple permissions supported.\n- Nice DSL for better code.\n- Written in Kotlin\n\n## What is the handling flow\n\n1. Show an explanation to the user why we need those permissions.\n2. If the user press ok, then we will request for the permissions.\n3. After getting the request result, we will handling 3 cases:\n    - When everything is fine\n    - When permissions not accepted\n    - When user checks the `Never Ask again` option, we will route the user to the application settings to enable the permission there.\n    \n\u003e No `shouldShowRationale`? Yes, this is such a confusing method depends on its name. In our flow, user always gets the explanation first, which should be a design which you always follow. But underneath, we use it to check the `NeverAskAgain` option.\n\n\n## How to use it\n\n1. Install (Not yet published)\n\n```groovy\nimplementation 'xyz.albertgao:permissionk:1.0.0'\n```\n\n2. Trigger the explanation step to invoking this function inside your activity, properly a onClickHandler\n\n```groovy\nstartToRequestPermission {\n    permissions = listOf(SEND_SMS, READ_PHONE_STATE)\n    requestCode = this@MyActivity.requestCode\n\n    ifSuccess {\n        // Your handling logic\n    }\n\n    elseShowDialogToRequestPermission{\n        message = \"Hi, We need these permissions because we want to make the user experiences better, please grant them!\"\n    }\n}\n```\n\n3. Inside the onRequestPermissionResult method, by using the following DSL:\n\n```kotlin\noverride fun onRequestPermissionsResult(\n    theRequestCode: Int,\n    thePermissions: Array\u003cString\u003e,\n    theGrantResults: IntArray\n) {\n    onRequestPermissionResultHandler {\n        actualRequestCode = theRequestCode\n        expectRequestCode = this@MyActivity.requestCode\n        permissions = thePermissions\n        grantResultsParam = theGrantResults\n\n\n        onSuccess {\n            // Do what you want\n        }\n\n        onFailure {\n            // You don't get the permission, do something\n        }\n\n        onNeverAskAgain {\n            message = \"We noticed you have disabled some permissions . We will take you to the Application settings, you can re-enable the permission there.\"\n        }\n    }\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbert-gao%2Fpermissionk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbert-gao%2Fpermissionk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbert-gao%2Fpermissionk/lists"}