{"id":17679422,"url":"https://github.com/florent37/runtimepermission","last_synced_at":"2025-04-04T06:07:13.378Z","repository":{"id":91120206,"uuid":"125537016","full_name":"florent37/RuntimePermission","owner":"florent37","description":"Simpliest way to ask runtime permissions on Android, no need to extend class or override permissionResult method, choose your way : Kotlin / Coroutines / RxJava / Java7 / Java8","archived":false,"fork":false,"pushed_at":"2021-10-14T14:23:00.000Z","size":513,"stargazers_count":865,"open_issues_count":9,"forks_count":71,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-03-28T05:09:52.276Z","etag":null,"topics":["android","async","coroutines","kotlin","lambda","launch","manifest","marshmallow","permission","runtime","rx","rxjava"],"latest_commit_sha":null,"homepage":"https://florent37.github.io/RuntimePermission/","language":"Java","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/florent37.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"ko_fi":"FlorentChampigny","github":"florent37"}},"created_at":"2018-03-16T15:42:58.000Z","updated_at":"2025-01-31T10:38:46.000Z","dependencies_parsed_at":"2023-11-10T20:46:27.811Z","dependency_job_id":null,"html_url":"https://github.com/florent37/RuntimePermission","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FRuntimePermission","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FRuntimePermission/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FRuntimePermission/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/florent37%2FRuntimePermission/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/florent37","download_url":"https://codeload.github.com/florent37/RuntimePermission/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247128746,"owners_count":20888235,"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","async","coroutines","kotlin","lambda","launch","manifest","marshmallow","permission","runtime","rx","rxjava"],"created_at":"2024-10-24T08:41:53.926Z","updated_at":"2025-04-04T06:07:13.359Z","avatar_url":"https://github.com/florent37.png","language":"Java","readme":"Runtime Permission\n===================\n\n[![CircleCI](https://circleci.com/gh/florent37/RuntimePermission/tree/master.svg?style=svg)](https://circleci.com/gh/florent37/RuntimePermission/tree/master)\n[![Language](https://img.shields.io/badge/compatible-java%20%7C%20kotlin%20%7C%20rx-brightgreen.svg)](https://www.github.com/florent37/RuntimePermission)\n\n[![screen](https://raw.githubusercontent.com/florent37/RuntimePermission/master/medias/intro.png)](https://www.github.com/florent37/RuntimePermission)\n\nSimpliest way to ask runtime permissions on Android, choose your way : \n- [Kotlin](https://github.com/florent37/RuntimePermission#kotlin)\n- [Kotlin with Coroutines](https://github.com/florent37/RuntimePermission#kotlin-coroutines)\n- [RxJava](https://github.com/florent37/RuntimePermission#rxjava)\n- [Java8](https://github.com/florent37/RuntimePermission#java8)\n- [Java7](https://github.com/florent37/RuntimePermission#java7)\n\n**No need to override Activity or Fragment**`onPermissionResult(code, permissions, result)`**using this library, you just have to executue RuntimePermission's methods** \nThis will not cut your code flow\n\n# General Usage (cross language)\n\n[ ![Download](https://api.bintray.com/packages/florent37/maven/runtime-permission/images/download.svg) ](https://bintray.com/florent37/maven/runtime-permission/)\n```java\ndependencies {\n    implementation 'com.github.florent37:runtime-permission:(lastest version)'\n}\n```\n\n\n## Detect Permissions\n\nRuntimePermission can automatically check **all** of your needed permissions\n\nFor example, if you add to your *AndroidManifest.xml* :\n\n[![screen](https://raw.githubusercontent.com/florent37/RuntimePermission/master/medias/manifest-permissions.png)](https://www.github.com/florent37/RuntimePermission)\n\nYou can use `askPermission` without specifying any permission\n\nFor example, in Kotlin: \n```\naskPermission(){\n   //all of your permissions have been accepted by the user\n}.onDeclined { e -\u003e \n   //at least one permission have been declined by the user \n}\n```\n\n[![screen](https://raw.githubusercontent.com/florent37/RuntimePermission/master/medias/permissions.png)](https://www.github.com/florent37/RuntimePermission)\n\nWill automatically ask for **CONTACTS** and **LOCALISATION** permissions\n\n## Manually call permissions\n\nYou just have to call `askPermission` with the list of wanted permissions\n\nIn Kotlin: \n```\naskPermission(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION){\n   //all of your permissions have been accepted by the user\n}.onDeclined { e -\u003e \n   //at least one permission have been declined by the user \n}\n```\n\n[![screen](https://raw.githubusercontent.com/florent37/RuntimePermission/master/medias/permissions.png)](https://www.github.com/florent37/RuntimePermission)\n\nWill ask for **CONTACTS** and **LOCALISATION** permissions\n\n# Kotlin-Coroutines\n\n```kotlin\nyourScope.launch {\n    try {\n        val result = askPermission(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION)\n        //all permissions already granted or just granted\n        //your action\n        resultView.setText(\"Accepted :${result.accepted.toString()}\")\n\n    } catch (e: PermissionException) {\n        if (e.hasDenied()) {\n            appendText(resultView, \"Denied :\")\n            //the list of denied permissions\n            e.denied.forEach { permission -\u003e\n                appendText(resultView, permission)\n            }\n            //but you can ask them again, eg:\n\n            AlertDialog.Builder(this@RuntimePermissionMainActivityKotlinCoroutine)\n                    .setMessage(\"Please accept our permissions\")\n                    .setPositiveButton(\"yes\") { dialog, which -\u003e\n                        e.askAgain()\n                    }\n                    .setNegativeButton(\"no\") { dialog, which -\u003e\n                        dialog.dismiss()\n                    }\n                    .show();\n        }\n\n        if (e.hasForeverDenied()) {\n            appendText(resultView, \"ForeverDenied\")\n            //the list of forever denied permissions, user has check 'never ask again'\n            e.foreverDenied.forEach { permission -\u003e\n                appendText(resultView, permission)\n            }\n            //you need to open setting manually if you really need it\n            e.goToSettings();\n        }\n    }\n}\n```\n\n### Download \n\n[ ![Download](https://api.bintray.com/packages/florent37/maven/runtime-permission/images/download.svg) ](https://bintray.com/florent37/maven/runtime-permission/)\n```groovy\nimplementation 'com.github.florent37:runtime-permission-kotlin:(last version)'\n```\n\n# Kotlin\n\n```kotlin\naskPermission(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION){\n   //all permissions already granted or just granted\n  \n   your action\n}.onDeclined { e -\u003e\n   if (e.hasDenied()) {\n       appendText(resultView, \"Denied :\")\n       //the list of denied permissions\n       e.denied.forEach {\n           appendText(resultView, it)\n       }\n\n       AlertDialog.Builder(this@RuntimePermissionMainActivityKotlin)\n               .setMessage(\"Please accept our permissions\")\n               .setPositiveButton(\"yes\") { dialog, which -\u003e\n                   e.askAgain();\n               } //ask again\n               .setNegativeButton(\"no\") { dialog, which -\u003e\n                   dialog.dismiss();\n               }\n               .show();\n   }\n\n   if(e.hasForeverDenied()) {\n       appendText(resultView, \"ForeverDenied :\")\n       //the list of forever denied permissions, user has check 'never ask again'\n       e.foreverDenied.forEach {\n           appendText(resultView, it)\n       }\n       // you need to open setting manually if you really need it\n       e.goToSettings();\n   }\n}\n```\n\n### Download \n\n[ ![Download](https://api.bintray.com/packages/florent37/maven/runtime-permission/images/download.svg) ](https://bintray.com/florent37/maven/runtime-permission/)\n```groovy\nimplementation 'com.github.florent37:runtime-permission-kotlin:(last version)'\n```\n\n# RxJava\n\n```java\nnew RxPermissions(this).request(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION))\n    .subscribe(result -\u003e {\n        //all permissions already granted or just granted\n\n        your action\n    }, throwable -\u003e {\n        final PermissionResult result = ((RxPermissions.Error) throwable).getResult();\n\n        if(result.hasDenied()) {\n            appendText(resultView, \"Denied :\");\n            //the list of denied permissions\n            for (String permission : result.getDenied()) {\n                appendText(resultView, permission);\n            }\n            //permission denied, but you can ask again, eg:\n\n\n            new AlertDialog.Builder(RuntimePermissionMainActivityRx.this)\n                    .setMessage(\"Please accept our permissions\")\n                    .setPositiveButton(\"yes\", (dialog, which) -\u003e {\n                        result.askAgain();\n                    }) // ask again\n                    .setNegativeButton(\"no\", (dialog, which) -\u003e {\n                        dialog.dismiss();\n                    })\n                    .show();\n        }\n\n        if(result.hasForeverDenied()) {\n            appendText(resultView, \"ForeverDenied :\");\n            //the list of forever denied permissions, user has check 'never ask again'\n            for (String permission : result.getForeverDenied()) {\n                appendText(resultView, permission);\n            }\n            // you need to open setting manually if you really need it\n            result.goToSettings();\n        }\n    });\n```\n\n### Download \n```groovy\nimplementation 'com.github.florent37:runtime-permission-rx:(last version)'\n```\n\n# Java8\n\n```java\naskPermission(this)\n     .request(Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION)\n\n     .onAccepted((result) -\u003e {\n         //all permissions already granted or just granted\n\n         your action\n     })\n     .onDenied((result) -\u003e {\n         appendText(resultView, \"Denied :\");\n         //the list of denied permissions\n         for (String permission : result.getDenied()) {\n             appendText(resultView, permission);\n         }\n         //permission denied, but you can ask again, eg:\n\n         new AlertDialog.Builder(RuntimePermissionMainActivityJava8.this)\n                 .setMessage(\"Please accept our permissions\")\n                 .setPositiveButton(\"yes\", (dialog, which) -\u003e {\n                     result.askAgain();\n                 }) // ask again\n                 .setNegativeButton(\"no\", (dialog, which) -\u003e {\n                     dialog.dismiss();\n                 })\n                 .show();\n\n     })\n     .onForeverDenied((result) -\u003e {\n         appendText(resultView, \"ForeverDenied :\");\n         //the list of forever denied permissions, user has check 'never ask again'\n         for (String permission : result.getForeverDenied()) {\n             appendText(resultView, permission);\n         }\n         // you need to open setting manually if you really need it\n         result.goToSettings();\n     })\n     .ask();\n```\n\n### Download\n \n[ ![Download](https://api.bintray.com/packages/florent37/maven/runtime-permission/images/download.svg) ](https://bintray.com/florent37/maven/runtime-permission/)\n```groovy\nimplementation 'com.github.florent37:runtime-permission:(last version)'\n```\n \n# Java7\n\n```java\naskPermission(this, Manifest.permission.READ_CONTACTS, Manifest.permission.ACCESS_FINE_LOCATION)\n    .ask(new PermissionListener() {\n        @Override\n        public void onAccepted(RuntimePermission runtimePermission, List\u003cString\u003e accepted) {\n            //all permissions already granted or just granted\n\n            your action\n        }\n\n        @Override\n        public void onDenied(RuntimePermission runtimePermission, List\u003cString\u003e denied, List\u003cString\u003e foreverDenied) {\n            if(permissionResult.hasDenied()) {\n                appendText(resultView, \"Denied :\");\n                //the list of denied permissions\n                for (String permission : denied) {\n                    appendText(resultView, permission);\n                }\n\n                //permission denied, but you can ask again, eg:\n\n                new AlertDialog.Builder(RuntimePermissionMainActivityJava7.this)\n                        .setMessage(\"Please accept our permissions\")\n                        .setPositiveButton(\"yes\", (dialog, which) -\u003e {\n                            permissionResult.askAgain();\n                        }) // ask again\n                        .setNegativeButton(\"no\", (dialog, which) -\u003e {\n                            dialog.dismiss();\n                        })\n                        .show();\n            }\n\n\n            if(permissionResult.hasForeverDenied()) {\n                appendText(resultView, \"ForeverDenied :\");\n                //the list of forever denied permissions, user has check 'never ask again'\n                for (String permission : foreverDenied) {\n                    appendText(resultView, permission);\n                }\n                // you need to open setting manually if you really need it\n                permissionResult.goToSettings();\n            }\n        }\n    });\n```\n\n# How to Contribute\n\nWe welcome your contributions to this project. \n\nThe best way to submit a patch is to send us a [pull request](https://help.github.com/articles/about-pull-requests/). \n\nTo report a specific problem or feature request, open a new issue on Github. \n\n# Credits\n\nManifest permission detection has been forked from https://github.com/sensorberg-dev/permission-bitte, \nthanks **Sensorberg GmbH**\n\nAuthor: Florent Champigny \n\nBlog : [http://www.tutos-android-france.com/](http://www.tutos-android-france.com/)\n\nFiches Plateau Moto : [https://www.fiches-plateau-moto.fr/](https://www.fiches-plateau-moto.fr/)\n\n\u003ca href=\"https://goo.gl/WXW8Dc\"\u003e\n  \u003cimg alt=\"Android app on Google Play\" src=\"https://developer.android.com/images/brand/en_app_rgb_wo_45.png\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://plus.google.com/+florentchampigny\"\u003e\n  \u003cimg alt=\"Follow me on Google+\"\n       src=\"https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/gplus.png\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://twitter.com/florent_champ\"\u003e\n  \u003cimg alt=\"Follow me on Twitter\"\n       src=\"https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/twitter.png\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.linkedin.com/in/florentchampigny\"\u003e\n  \u003cimg alt=\"Follow me on LinkedIn\"\n       src=\"https://raw.githubusercontent.com/florent37/DaVinci/master/mobile/src/main/res/drawable-hdpi/linkedin.png\" /\u003e\n\u003c/a\u003e\n\n# License\n\n    Copyright 2018 florent37, Inc.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":["https://ko-fi.com/FlorentChampigny","https://github.com/sponsors/florent37"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorent37%2Fruntimepermission","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflorent37%2Fruntimepermission","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflorent37%2Fruntimepermission/lists"}