{"id":17643803,"url":"https://github.com/vanniktech/rxpermission","last_synced_at":"2025-04-12T15:43:58.336Z","repository":{"id":37413084,"uuid":"99154556","full_name":"vanniktech/RxPermission","owner":"vanniktech","description":"Reactive permissions for Android","archived":false,"fork":false,"pushed_at":"2025-03-25T05:39:53.000Z","size":880,"stargazers_count":199,"open_issues_count":1,"forks_count":27,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-03T17:11:33.063Z","etag":null,"topics":["android","permissions","rxjava","rxjava2","rxpermission","rxpermissions"],"latest_commit_sha":null,"homepage":"http://vanniktech.com","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/vanniktech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":{"github":["vanniktech"]}},"created_at":"2017-08-02T19:42:17.000Z","updated_at":"2025-03-25T05:38:54.000Z","dependencies_parsed_at":"2023-02-10T13:30:33.120Z","dependency_job_id":"6f667d51-307f-4143-b419-6d04e3993364","html_url":"https://github.com/vanniktech/RxPermission","commit_stats":{"total_commits":259,"total_committers":8,"mean_commits":32.375,"dds":0.4054054054054054,"last_synced_commit":"4df533d02584162150b5752ec7781e905fe654c8"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2FRxPermission","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2FRxPermission/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2FRxPermission/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanniktech%2FRxPermission/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanniktech","download_url":"https://codeload.github.com/vanniktech/RxPermission/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590987,"owners_count":21129927,"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","permissions","rxjava","rxjava2","rxpermission","rxpermissions"],"created_at":"2024-10-23T09:42:56.091Z","updated_at":"2025-04-12T15:43:58.316Z","avatar_url":"https://github.com/vanniktech.png","language":"Java","funding_links":["https://github.com/sponsors/vanniktech"],"categories":[],"sub_categories":[],"readme":"RxPermission\n============\n\nThis library wraps the Android Runtime Permissions with RxJava 2. It's based on the [RxPermissions](https://github.com/tbruyelle/RxPermissions) library and was adjusted with simplicity in mind. Here are a few things that are different:\n\n- API is really small and focused\n- Uses a shadowing Activity to request the permission which allows you to use the library within Services, Broadcastreceiver etc.\n- Supports the 'Never ask again' case\n\n# Download\n\n```groovy\nimplementation 'com.vanniktech:rxpermission:0.11.0'\nimplementation 'com.vanniktech:rxpermission:0.12.0-SNAPSHOT'\n```\n\n# Usage\n\nThe core functionality is provided via an interface:\n\n```kotlin\ninterface RxPermission {\n  /** Requests a single permission.  */\n  @CheckReturnValue fun request(permission: String): Single\u003cPermission\u003e\n\n  /** Requests multiple permissions.  */\n  @CheckReturnValue fun requestEach(vararg permissions: String): Observable\u003cPermission\u003e\n\n  /** Returns true when the given permission is granted.  */\n  @CheckReturnValue fun isGranted(permission: String): Boolean\n\n  /** Returns true when the given permission is revoked by a policy.  */\n  @CheckReturnValue fun isRevokedByPolicy(permission: String): Boolean\n\n  /** Returns tue when the given permission has been request at least once using either [request] or [requestEach].  */\n  @CheckReturnValue fun hasRequested(permission: String): Boolean\n}\n```\n\nAnd the Permission class:\n\n```java\npublic class Permission {\n  /** The name of the permission. For instance android.permission.CAMERA */\n  @NonNull public String name();\n\n  /** The state of the permission. */\n  @NonNull public State state();\n\n  public enum State {\n    /** Permission has been granted. */\n    GRANTED,\n\n    /** Permission has been denied. */\n    DENIED,\n\n    /**\n     * Permission is denied.\n     * Previously the requested permission was denied and never ask again was selected.\n     * This means that the user hasn't seen the permission dialog.\n     * The only way to let the user grant the permission is via the settings now.\n     */\n    DENIED_NOT_SHOWN,\n\n    /** Permission has been revoked by a policy. */\n    REVOKED_BY_POLICY\n  }\n}\n```\n\n## Production\n\nFor your Android application you can get an instance of the interface via `RealRxPermission.getInstance(application)` and then simply use the above mentioned methods to your needs.\n\n```java\nRealRxPermission.getInstance(application)\n    .request(Manifest.permission.CAMERA)\n    .subscribe();\n```\n\n## Testing\n\nIn addition the library offers you a `MockRxPermission` that can be used for testing.\n\n```gradle\nimplementation 'com.vanniktech:rxpermission-testing:0.11.0'\n```\n\nThe constructor takes a vararg of Permissions.\n\n```java\nnew MockRxPermission(Permission.denied(Manifest.permission.CAMERA))\n    .request(Manifest.permission.CAMERA)\n    .test()\n    .assertResult(Permission.denied(Manifest.permission.CAMERA));\n```\n\nThe Permission class provides you a few static factory methods:\n\n```java\n/** This will create a granted Camera Permission instance. */\nPermission.granted(Manifest.permission.CAMERA)\n\n/** This will create a denied Camera Permission instance. */\nPermission.denied(Manifest.permission.CAMERA)\n\n/** This will create a denied not shown Camera Permission instance. */\nPermission.deniedNotShown(Manifest.permission.CAMERA)\n\n/** This will create a revoked by policy Camera Permission instance. */\nPermission.revokedByPolicy(Manifest.permission.CAMERA)\n```\n\n## Sample\n\nAlso checkout the sample app that shows you how to use the library.\n\n# License\n\nCopyright (C) 2017 Vanniktech - Niklas Baudy\n\nLicensed under the Apache License, Version 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanniktech%2Frxpermission","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanniktech%2Frxpermission","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanniktech%2Frxpermission/lists"}