gitmyhub

XXPermissions

Java ★ 6.8k updated 7d ago

Android Permissions Framework, Adapt to Android 17

An Android library that handles runtime permission requests with a short call chain, automatically managing differences across Android versions and covering special permissions like overlay and battery optimization.

JavaAndroidGradleJitPacksetup: easycomplexity 2/5

XXPermissions is an Android library that simplifies the process of requesting user permissions inside mobile apps. Android requires apps to ask the user's consent before accessing things like the camera, microphone, location, or storage, and the rules around how to ask have changed significantly across Android versions. This library handles those differences automatically, with stated support up to Android 16.

The main appeal is a short, readable call chain. A developer adds a few lines of code, specifies which permissions the app needs, and attaches a callback that receives two lists: the permissions that were granted and the ones that were denied. From there the app can check whether everything was approved or branch on specific failures. There is also a helper to detect whether a user has checked the "don't ask again" box on a particular permission, which changes what the app should do next.

The library also covers special permissions that sit outside the standard Android flow, such as the overlay permission that allows drawing on top of other apps, battery optimization exemptions, usage stats access, notification listener access, VPN binding, and others. These typically require navigating the user to a system settings screen rather than showing a dialog, and XXPermissions handles that routing.

Integration is through JitPack. A developer adds the JitPack repository to the Gradle configuration and then adds the library as a dependency. There is a separate companion library for device-specific compatibility. Obfuscation rules are bundled so no manual ProGuard setup is needed.

The README is primarily in Chinese, with an English version linked from the top. It includes screenshots of the demo app covering over a dozen different permission types, along with helper methods for checking whether permissions are currently granted, comparing permission names, and jumping directly to the relevant settings page.

Where it fits