[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-4083":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":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":34,"discoverSource":35},4083,"PermissionsDispatcher","permissions-dispatcher\u002FPermissionsDispatcher","permissions-dispatcher","A declarative API to handle Android runtime permissions.","https:\u002F\u002Fgithub.com\u002Fpermissions-dispatcher\u002FPermissionsDispatcher",null,"Java",11177,1433,259,29,0,2,5,70.97,"Apache License 2.0",false,"master",[24,25,26,27,28,29,30],"android","java","kotlin","permission","permission-android","permissions","permissions-android","2026-06-12 04:00:21","# PermissionsDispatcher ![CI for pull request](https:\u002F\u002Fgithub.com\u002Fpermissions-dispatcher\u002FPermissionsDispatcher\u002Fworkflows\u002FCI%20for%20pull%20request\u002Fbadge.svg) [![PermissionsDispatcher](https:\u002F\u002Fwww.appbrain.com\u002Fstats\u002Flibraries\u002Fshield\u002Fpermissions_dispatcher.svg)](https:\u002F\u002Fwww.appbrain.com\u002Fstats\u002Flibraries\u002Fdetails\u002Fpermissions_dispatcher\u002Fpermissionsdispatcher)\n\n- **Fully Kotlin\u002FJava support**\n- [**Special permissions support**](https:\u002F\u002Fgithub.com\u002Fhotchemi\u002FPermissionsDispatcher\u002Fblob\u002Fmaster\u002Fdoc\u002Fspecial_permissions.md)\n- **100% reflection-free**\n\nPermissionsDispatcher provides a simple annotation-based API to handle runtime permissions.\n\nThis library lifts the burden that comes with writing a bunch of check statements whether a permission has been granted or not from you, in order to keep your code clean and safe.\n\n## Usage\n\n- Kotlin: You can pick either of [ktx](https:\u002F\u002Fgithub.com\u002Fpermissions-dispatcher\u002FPermissionsDispatcher\u002Ftree\u002Fmaster\u002Fktx) or [kapt](https:\u002F\u002Fgithub.com\u002Fpermissions-dispatcher\u002FPermissionsDispatcher#0-prepare-androidmanifest).\n- Java: [apt](https:\u002F\u002Fgithub.com\u002Fhotchemi\u002FPermissionsDispatcher\u002Fblob\u002Fmaster\u002Fdoc\u002Fjava_usage.md)\n\nHere's a minimum example, in which you register a `MainActivity` which requires `Manifest.permission.CAMERA`.\n\n### 0. Prepare AndroidManifest\n\nAdd the following line to `AndroidManifest.xml`:\n \n`\u003Cuses-permission android:name=\"android.permission.CAMERA\" \u002F>`\n\n### 1. Attach annotations\n\nPermissionsDispatcher introduces only a few annotations, keeping its general API concise:\n\n> NOTE: Annotated methods must not be `private`.\n\n|Annotation|Required|Description|\n|---|---|---|\n|`@RuntimePermissions`|**✓**|Register an `Activity` or `Fragment` to handle permissions|\n|`@NeedsPermission`|**✓**|Annotate a method which performs the action that requires one or more permissions|\n|`@OnShowRationale`||Annotate a method which explains why the permissions are needed. It passes in a `PermissionRequest` object which can be used to continue or abort the current permission request upon user input. If you don't specify any argument for the method compiler will generate `process${NeedsPermissionMethodName}ProcessRequest` and `cancel${NeedsPermissionMethodName}ProcessRequest`. You can use those methods in place of `PermissionRequest`(ex: with `DialogFragment`)|\n|`@OnPermissionDenied`||Annotate a method which is invoked if the user doesn't grant the permissions|\n|`@OnNeverAskAgain`||Annotate a method which is invoked if the user chose to have the device \"never ask again\" about a permission|\n\n```kotlin\n@RuntimePermissions\nclass MainActivity : AppCompatActivity(), View.OnClickListener {\n\n    @NeedsPermission(Manifest.permission.CAMERA)\n    fun showCamera() {\n        supportFragmentManager.beginTransaction()\n                .replace(R.id.sample_content_fragment, CameraPreviewFragment.newInstance())\n                .addToBackStack(\"camera\")\n                .commitAllowingStateLoss()\n    }\n\n    @OnShowRationale(Manifest.permission.CAMERA)\n    fun showRationaleForCamera(request: PermissionRequest) {\n        showRationaleDialog(R.string.permission_camera_rationale, request)\n    }\n\n    @OnPermissionDenied(Manifest.permission.CAMERA)\n    fun onCameraDenied() {\n        Toast.makeText(this, R.string.permission_camera_denied, Toast.LENGTH_SHORT).show()\n    }\n\n    @OnNeverAskAgain(Manifest.permission.CAMERA)\n    fun onCameraNeverAskAgain() {\n        Toast.makeText(this, R.string.permission_camera_never_askagain, Toast.LENGTH_SHORT).show()\n    }\n}\n```\n\n### 2. Delegate to generated functions\n\nNow generated functions become much more concise and intuitive than Java version!\n\n```kotlin\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_main)\n        findViewById(R.id.button_camera).setOnClickListener {\n            \u002F\u002F NOTE: delegate the permission handling to generated function\n            showCameraWithPermissionCheck()\n        }\n    }\n\n    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array\u003CString>, grantResults: IntArray) {\n        super.onRequestPermissionsResult(requestCode, permissions, grantResults)\n        \u002F\u002F NOTE: delegate the permission handling to generated function\n        onRequestPermissionsResult(requestCode, grantResults)\n    }\n```\n\nCheck out the [sample](https:\u002F\u002Fgithub.com\u002Fhotchemi\u002FPermissionsDispatcher\u002Ftree\u002Fmaster\u002Fsample) for more details.\n\n## Other features\u002Fplugins\n\n- [Getting Special Permissions](https:\u002F\u002Fgithub.com\u002Fhotchemi\u002FPermissionsDispatcher\u002Fblob\u002Fmaster\u002Fdoc\u002Fspecial_permissions.md)\n- [maxSdkVersion](https:\u002F\u002Fgithub.com\u002Fhotchemi\u002FPermissionsDispatcher\u002Fblob\u002Fmaster\u002Fdoc\u002Fmaxsdkversion.md)\n- [IntelliJ plugin](https:\u002F\u002Fgithub.com\u002Fshiraji\u002Fpermissions-dispatcher-plugin)\n- [AndroidAnnotations plugin](https:\u002F\u002Fgithub.com\u002FAleksanderMielczarek\u002FAndroidAnnotationsPermissionsDispatcherPlugin)\n\n## Installation\n\n**NOTE:**\n  - If you're using jCenter we've moved on to MavenCentral, see [migration guide](https:\u002F\u002Fgithub.com\u002Fhotchemi\u002FPermissionsDispatcher\u002Fblob\u002Fmaster\u002Fdoc\u002Fmigration_guide.md).\n  - 4.x only supports [Jetpack](https:\u002F\u002Fdeveloper.android.com\u002Fjetpack\u002F). If you still use appcompat 3.x is the way to go.\n\nTo add PermissionsDispatcher to your project, include the following in your **app module** `build.gradle` file:\n\n`${latest.version}` is [![Download](https:\u002F\u002Fmaven-badges.herokuapp.com\u002Fmaven-central\u002Fcom.github.permissions-dispatcher\u002Fpermissionsdispatcher\u002Fbadge.svg)](https:\u002F\u002Fsearch.maven.org\u002Fsearch?q=g:com.github.permissions-dispatcher)\n\n```groovy\ndependencies {\n  implementation \"com.github.permissions-dispatcher:permissionsdispatcher:${latest.version}\"\n  annotationProcessor \"com.github.permissions-dispatcher:permissionsdispatcher-processor:${latest.version}\"\n}\n```\n\nWith Kotlin:\n\n```groovy\napply plugin: 'kotlin-kapt'\n\ndependencies {\n  implementation \"com.github.permissions-dispatcher:permissionsdispatcher:${latest.version}\"\n  kapt \"com.github.permissions-dispatcher:permissionsdispatcher-processor:${latest.version}\"\n}\n```\n\n## License\n\n```\nCopyright 2016 Shintaro Katafuchi, Marcel Schnelle, Yoshinori Isogai\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","PermissionsDispatcher 是一个用于处理 Android 运行时权限的声明式 API。其核心功能是通过简单的注解来管理权限请求，支持 Kotlin 和 Java 语言，并且完全不使用反射技术以提高性能。该库简化了权限检查逻辑，使得开发者可以专注于业务代码而无需担心复杂的权限处理流程。它特别适合需要频繁请求用户授权的应用场景，如相机、位置等敏感权限的使用，能够帮助开发者保持代码的简洁性和安全性。","2026-06-11 02:58:21","top_language"]