{"id":25195993,"url":"https://github.com/simplisticated/consent","last_synced_at":"2026-04-26T20:31:51.516Z","repository":{"id":140530544,"uuid":"169159147","full_name":"simplisticated/Consent","owner":"simplisticated","description":"Easy Android permissions. Powered by Kotlin.","archived":false,"fork":false,"pushed_at":"2019-03-17T01:22:04.000Z","size":363,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-01T22:03:18.042Z","etag":null,"topics":["android","android-permissions","kotlin","kotlin-library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simplisticated.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-04T22:22:31.000Z","updated_at":"2022-10-03T16:45:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4616e6b-7e05-43b7-b9d8-5e3c1c9e9cc5","html_url":"https://github.com/simplisticated/Consent","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/simplisticated/Consent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FConsent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FConsent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FConsent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FConsent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplisticated","download_url":"https://codeload.github.com/simplisticated/Consent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplisticated%2FConsent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32312227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T19:15:34.056Z","status":"ssl_error","status_checked_at":"2026-04-26T19:15:15.467Z","response_time":129,"last_error":"SSL_read: 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","android-permissions","kotlin","kotlin-library"],"created_at":"2025-02-10T01:39:22.649Z","updated_at":"2026-04-26T20:31:51.511Z","avatar_url":"https://github.com/simplisticated.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" \u003e\n\t\u003cimg src=\"images/logo_2048_2048.png\" alt=\"Consent\" title=\"Consent\" width=\"300\" height=\"300\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://http://www.android.com\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/badge/android-23-green.svg?style=flat\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://jitpack.io/#igormatyushkin014/Consent\"\u003e\n\t\t\u003cimg src=\"https://jitpack.io/v/igormatyushkin014/Consent.svg\"\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://tldrlegal.com/license/apache-license-2.0-(apache-2.0)\"\u003e\n\t\t\u003cimg src=\"https://img.shields.io/badge/License-Apache 2.0-blue.svg?style=flat\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n## At a Glance\n\n`Consent` is a library that makes permissions management in Android significantly easier.\n\n## How to Get Started\n\nAdd `jitpack.io` repository to your project:\n\n```javascript\nallprojects {\n    repositories {\n        jcenter()\n        maven {\n\t    url \"https://jitpack.io\"\n\t}\n    }\n}\n```\n\nThen add `Consent` to dependencies list:\n\n```javascript\ndependencies {\n    implementation 'com.github.igormatyushkin014:Consent:1.2'\n}\n```\n\n## Requirements\n\n* Android SDK 23 and later\n* Android Studio 3.3 and later\n* Kotlin 1.3.20 or later\n\n## Usage\n\nThe main idea of `Consent` library is to keep all things as simple as possible. That's why all methods are available directly from `Activity` and `Context` instances.\n\nYou can use string permissions from `Manifest.permission` collection or special `Permission` type. Example:\n\n```kotlin\nval stringPermission = Manifest.permission.CAMERA\nval permission = Permission.CAMERA\n```\n\nAll public methods in the library give you a freedom to choose whether you want to use string values or built-in permissions. The `Permission` class gives you a little more flexibility, but you always can decide whether you need it.\n\n### Check Permissions\n\nLambda syntax:\n\n```kotlin\ncheckConsent(\n    Permission.CAMERA,\n    Permission.WRITE_EXTERNAL_STORAGE\n).whenFinished { result -\u003e\n    if (result.hasBlocked) {\n        /*\n         * Some permissions are blocked.\n         * Let's learn how to retrieve them.\n         */\n        result.blocked // Contains blocked permissions\n        result.allowed // Contains available permissions\n    } else {\n        // All permissions are available\n    }\n}\n```\n\nRegular syntax:\n\n```kotlin\nval result = checkConsent(\n    Permission.CAMERA,\n    Permission.WRITE_EXTERNAL_STORAGE\n).result\n\nif (result.hasBlocked) {\n    // Handle blocked permissions\n} else {\n    // All permissions are available\n}\n```\n\nAnother example of regular syntax:\n\n```kotlin\nval allowedAccess = !checkConsent(\n    Manifest.permission.CAMERA,\n    Manifest.permission.WRITE_EXTERNAL_STORAGE\n).result.hasBlocked\n\nif (allowedAccess) {\n    // All permissions are available\n} else {\n    // Show warning to user\n}\n```\n\nBoth syntaxes are equivalent to each other and interchangeable. In other words, both of them return the same result. That's up to you which one to use.\n\n### Request Permissions\n\nThe same as previous example but replace `checkConsent` with `getConsent`:\n\n```kotlin\ngetConsent(\n    Permission.CAMERA,\n    Permission.WRITE_EXTERNAL_STORAGE\n).whenFinished { result -\u003e\n    // Handle the result\n}\n```\n\nAlso, you have to override activity's `onRequestPermissionsResult()` method:\n\n```kotlin\noverride fun onRequestPermissionsResult(\n    requestCode: Int,\n    permissions: Array\u003cout String\u003e,\n    grantResults: IntArray\n) {\n    handleConsent(\n        requestCode,\n        permissions,\n        grantResults\n    )\n}\n```\n\nNow, you're all set 🎉🎉🎉\n\n### Syntactic sugar\n\nSince version `1.2` you can also check permissions directly from `Permission` object:\n\n```kotlin\nval result = Permission.CAMERA.checkConsent(\n    this\n).result\n```\n\nAlso, from array:\n\n```kotlin\nval result = arrayOf(\n    Permission.CAMERA,\n    Permission.WRITE_EXTERNAL_STORAGE\n).checkConsent(this).result\n```\n\nLambda version:\n\n```kotlin\narrayOf(\n    Permission.CAMERA,\n    Permission.WRITE_EXTERNAL_STORAGE\n).checkConsent(this).whenFinished { result -\u003e\n    // Handle result\n}\n```\n\nYou can also request for single permission in similar way:\n\n```kotlin\n// Request single permission\n\nPermission.CAMERA.getConsent(\n    this\n).whenFinished { result -\u003e\n    // Handle result\n}\n```\n\nRequest for multiple permissions:\n\n```kotlin\narrayOf(\n    Permission.CAMERA,\n    Permission.WRITE_EXTERNAL_STORAGE\n).getConsent(this).whenFinished { result -\u003e\n    // Handle result\n}\n```\n\n## License\n\n`Consent` is available under the Apache 2.0 license. See the [LICENSE](./LICENSE) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplisticated%2Fconsent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplisticated%2Fconsent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplisticated%2Fconsent/lists"}