AndPermission Documentation

repository·master·Indexed 27 days ago

https://github.com/yanzhenjie/andpermission

A lightweight Android library for simplifying requests for runtime permissions, system settings modification, and notification access. Supports AndroidX and requires a minimum API level of 14.

Tokens
404
Snippets
2
Records
3
Agent score
42%

What's inside AndPermission

  1. Request runtime permissions with AndPermission

    master

    Use the AndPermission.with(context) builder to request runtime permissions. You can specify permission groups using Permission.Group and handle the results via onGranted and onDenied callbacks. Call .start() to initiate the request.

    AndPermission.with(this)
      .runtime()
      .permission(Permission.Group.STORAGE)
      .onGranted(permissions -> {
        // Storage permission are allowed.
      })
      .onDenied(permissions -> {
        // Storage permission are not allowed.
      })
      .start();
  2. Supported permission types in AndPermission

    master

    AndPermission provides simplified wrappers for requesting several sensitive Android permissions, including:

    • Runtime permissions: Standard runtime permission requests.
    • Private files: Sharing private files.
    • Install unknown sources: android.permission.REQUEST_INSTALL_PACKAGES
    • Draw over other apps: android.permission.SYSTEM_ALERT_WINDOW
    • Show notifications: Requesting notification access.
    • Access notifications: android.permission.BIND_NOTIFICATION_LISTENER_SERVICE
    • Modify system settings: android.permission.WRITE_SETTINGS