[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7345":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":28,"readmeContent":29,"aiSummary":30,"trendingCount":16,"starSnapshotCount":16,"syncStatus":18,"lastSyncTime":31,"discoverSource":32},7345,"PermissionX","guolindev\u002FPermissionX","guolindev","An open source Android library that makes handling runtime permissions extremely easy.","",null,"Kotlin",3665,418,33,73,0,1,2,4,29.87,"Apache License 2.0",false,"master",true,[26,27],"android","permissionx","2026-06-12 02:01:38","# PermissionX\n\n[中文文档](https:\u002F\u002Fblog.csdn.net\u002Fsinyu890807\u002Fcategory_10108528.html)\n\nPermissionX is an extension Android library that makes Android runtime permission request extremely easy. You can use it for basic permission request occasions or handle more complex conditions, like showing rationale dialog or go to app settings for allowance manually.\n\n## Quick Setup\n\nEdit your build.gradle file and add below dependency.\n\n```groovy\nrepositories {\n  google()\n  mavenCentral()\n}\n\ndependencies {\n    implementation 'com.guolindev.permissionx:permissionx:1.8.1'\n}\n```\n\nThat's all. Now you are ready to go.\n\n## Basic Usage\n\nUse PermissionX to request Android runtime permissions is extremely simple.\n\nFor example. If you want to request READ_CONTACTS, CAMERA and CALL_PHONE permissions, declared them in the AndroidManifest.xml first.\n\n```xml\n\u003Cmanifest xmlns:android=\"http:\u002F\u002Fschemas.android.com\u002Fapk\u002Fres\u002Fandroid\"\n    package=\"com.permissionx.app\">\n\n\t\u003Cuses-permission android:name=\"android.permission.READ_CONTACTS\" \u002F>\n\t\u003Cuses-permission android:name=\"android.permission.CAMERA\" \u002F>\n\t\u003Cuses-permission android:name=\"android.permission.CALL_PHONE\" \u002F>\n\n\u003C\u002Fmanifest>\n```\n\nThen you can use below codes to request.\n\n```kotlin\nPermissionX.init(activity)\n    .permissions(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA, Manifest.permission.CALL_PHONE)\n    .request { allGranted, grantedList, deniedList ->\n        if (allGranted) {\n            Toast.makeText(this, \"All permissions are granted\", Toast.LENGTH_LONG).show()\n        } else {\n            Toast.makeText(this, \"These permissions are denied: $deniedList\", Toast.LENGTH_LONG).show()\n        }\n    }\n```\n\nPass any instance of FragmentActivity or Fragment into **init** method, and specify the permissions that you want to request in the **permissions** method, then call **request** method for actual request.\n\nThe request result will be callback in the request lambda. **allGranted** means if all permissions that you requested are granted by user, maybe true or false. **grantedList** holds all granted permissions and **deniedList** holds all denied permissions.\n\n\u003Cimg src=\"screenshots\u002F1.gif\" width=\"32%\" \u002F>\n\nNow you can write your own logic in the request lambda to handle the specific cases of your app.\n\n## More Usage\n\nAs you know, Android provide **shouldShowRequestPermissionRationale** method to indicate us if we should show a rationale dialog to explain to user why we need this permission. Otherwise user may deny the permissions we requested and checked **never ask again** option.\n\nTo simplify this process, PermissionX provide **onExplainRequestReason** method. Chain this method before **request** method, If user deny one of the permissions, **onExplainRequestReason** method will get callback first. Then you can call **showRequestReasonDialog** method to explain to user why these permissions are necessary like below.\n\n```kotlin\nPermissionX.init(activity)\n    .permissions(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA, Manifest.permission.CALL_PHONE)\n    .onExplainRequestReason { scope, deniedList ->\n        scope.showRequestReasonDialog(deniedList, \"Core fundamental are based on these permissions\", \"OK\", \"Cancel\")\n    }\n    .request { allGranted, grantedList, deniedList ->\n        if (allGranted) {\n            Toast.makeText(this, \"All permissions are granted\", Toast.LENGTH_LONG).show()\n        } else {\n            Toast.makeText(this, \"These permissions are denied: $deniedList\", Toast.LENGTH_LONG).show()\n        }\n    }\n```\n\n**showRequestReasonDialog** method will prompt a rationale dialog with the information that second parameter provide. If user click positive button which shows text as third parameter provide, PermissionX will request again with the permissions that first parameter provide.\n\nThe fourth parameter as text for negative button is optional. If the denied permissions are necessary, you can ignore the fourth parameter and the dialog will be uncancelable. Which means user must allow these permissions for further usage.\n\n\u003Cimg src=\"screenshots\u002F2.gif\" width=\"32%\" \u002F>\n\nOf course, user still may deny some permissions and checked **never ask again** option. In this case, each time we request these permissions again will be denied automatically. The only thing we could do is prompt to users they need to allow these permissions manually in app settings for continuation usage. But PermissionX did better.\n\nPermissionX provide **onForwardToSettings** method for handling this occasion. Chain this method before **request** method, If some permissions are \"denied and never ask again\" by user, **onForwardToSettings** method will get callback. Then you can call **showForwardToSettingsDialog** method like below.\n\n```kotlin\nPermissionX.init(activity)\n    .permissions(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA, Manifest.permission.CALL_PHONE)\n    .onExplainRequestReason { scope, deniedList ->\n        scope.showRequestReasonDialog(deniedList, \"Core fundamental are based on these permissions\", \"OK\", \"Cancel\")\n    }\n    .onForwardToSettings { scope, deniedList ->\n        scope.showForwardToSettingsDialog(deniedList, \"You need to allow necessary permissions in Settings manually\", \"OK\", \"Cancel\")\n    }\n    .request { allGranted, grantedList, deniedList ->\n        if (allGranted) {\n            Toast.makeText(this, \"All permissions are granted\", Toast.LENGTH_LONG).show()\n        } else {\n            Toast.makeText(this, \"These permissions are denied: $deniedList\", Toast.LENGTH_LONG).show()\n        }\n    }\n```\n\nThe parameters in **onForwardToSettings** method are similar with **showRequestReasonDialog** method. When user click positive button, PermissionX will forward to the settings page of your app and user can turn on the necessary permissions very quickly. When user switch back to app, PermissionX will request the necessary permissions again automatically.\n\n\u003Cimg src=\"screenshots\u002F3.gif\" width=\"32%\" \u002F>\n\n## Explain Before Request\n\nIt is always a good manner to show the rationale dialog and explain to users why you need these permissions before you actually request them.\n\nTo do that with PermissionX is quite simple. Just use **explainReasonBeforeRequest** method like below.\n\n```kotlin\nPermissionX.init(activity)\n    .permissions(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA, Manifest.permission.CALL_PHONE)\n    .explainReasonBeforeRequest()\n    ...\n```\n\nNow everything works like charm.\n\n\u003Cimg src=\"screenshots\u002F4.gif\" width=\"32%\" \u002F>\n\n## Dark Theme\n\nThe rationale dialog provided by PermissionsX support Android dark theme automatically. If you change your device into dark theme, everything just works great.\n\n\u003Cimg src=\"screenshots\u002F5.gif\" width=\"32%\" \u002F>\n\n## License\n\n```\nCopyright (C) guolin, PermissionX Open Source Project\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:\u002F\u002Fwww.apache.org\u002Flicenses\u002FLICENSE-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","PermissionX 是一个开源的Android库，旨在简化运行时权限请求的过程。它使用Kotlin语言编写，支持基本的权限请求以及更复杂的场景，如显示解释对话框或引导用户手动开启权限。核心功能包括通过链式调用轻松设置和请求多个权限，并在回调中处理结果。适用于所有需要处理Android 6.0及以上版本运行时权限的应用开发场景，无论是简单的权限请求还是需要向用户解释为何需要特定权限的情况。其简洁的API设计使得集成和使用都非常方便。","2026-06-11 03:11:51","top_language"]