All Projects → abhinav272 → EasyGrant

abhinav272 / EasyGrant

Licence: other
EasyGrant is yet another Android Library to ease the process of asking Runtime Permissions, written in Kotlin compatible with both Kotlin and Java

Programming Languages

kotlin
9241 projects
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to EasyGrant

easypermissions-ktx
🔓 Kotlin version of the popular google/easypermissions wrapper library to simplify basic system permissions logic on Android M or higher.
Stars: ✭ 324 (+1925%)
Mutual labels:  runtime-permissions
OLA Play Music App
Music Streaming App
Stars: ✭ 27 (+68.75%)
Mutual labels:  runtime-permissions
view-admin-as
View the WordPress admin as a different role, switch between users, temporarily change your capabilities, set default screen settings for roles, manage your roles and capabilities.
Stars: ✭ 44 (+175%)
Mutual labels:  permission-manager
PermissionHelper
PermissionHelper for Android M, Kotlin best way
Stars: ✭ 72 (+350%)
Mutual labels:  runtime-permissions
PermissionManager
android6.0之后开始会有权限使用的问题。这个项目演示了如何在代码中动态申请权限。尤其是"存储"这一个在6.0之前不需要申请的权限,本项目以这个作为例子。
Stars: ✭ 21 (+31.25%)
Mutual labels:  permission-manager
Simplify-Permissions
Android library to simplifies the android permission request at runtime.
Stars: ✭ 22 (+37.5%)
Mutual labels:  permission-manager
ego
✅ An OAuth 2.0 Authorization service that supports multiple OpenID Connect Identity Providers
Stars: ✭ 17 (+6.25%)
Mutual labels:  permission-manager
KotlinProject
This repo help for all developer who want to learn android or want to work on advance feature of android. This repo created with help of @awesomeui, @materialdesign and android latest feature. this repo contain major feature like : @awesome UI, @Material design, @firebase (auth, realtime database, firestore, push notification), @database (Room d…
Stars: ✭ 40 (+150%)
Mutual labels:  runtime-permissions
EffortlessPermissions
An Android permission library extending Google's EasyPermissions with convenient additions.
Stars: ✭ 84 (+425%)
Mutual labels:  runtime-permissions
startask-permissions
Is a library that helps to handle runtime permissions on Android, entirely written using Kotlin language.
Stars: ✭ 39 (+143.75%)
Mutual labels:  runtime-permissions
MayI
Android Runtime Permissions made easy
Stars: ✭ 17 (+6.25%)
Mutual labels:  runtime-permissions
permissionUtil
Simple permission helper
Stars: ✭ 64 (+300%)
Mutual labels:  runtime-permissions

EasyGrant

EasyGrant is yet another Android Library to ease the process of asking Runtime Permissions. Quoting Android official site -- Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app. This approach streamlines the app install process, since the user does not need to grant permissions when they install or update the app. It also gives the user more control over the app's functionality; for example, a user could choose to give a camera app access to the camera but not to the device location. The user can revoke the permissions at any time, by going to the app's Settings screen.

Actual code for seeking permissions, showing rationale and handling disabled permissions is little complex and tightly coupled with Activity.

HOW IT WORKS

Firstly, create PermissionRequest

private var cameraPermission = PermissionRequest(Manifest.permission.CAMERA,
            "I need camera permission to show you world", 1)

Secondly, call the method like this for single permission

private fun askCamPermission() {
        EasyGrant.Builder()
                .withActivity(this)
                .withPermission(cameraPermission)
                .setCallback(this)
                .seek()
    }

EasyGrant will provide simple callback of GrantCallbacks like

interface GrantCallbacks {
   
    fun onPermissionDenied(deniedPermissions: ArrayList<PermissionRequest>)

    fun onPermissionDisabled(disabledPermissions: ArrayList<PermissionRequest>)

    fun onPermissionGranted(grantedPermissions: ArrayList<PermissionRequest>)
}

EasyGrant seeks either a single permission or seeks multiple permissions in one go. To seek a single permission you must call withPermission(permissionRequest: PermissionRequest), To seek multiple permission you must call withPermissions(permissionsRequest: List<PermissionRequest>)

PermissionRequest takes permission name, rationale message to be shown and id.

EasyGrant throws IllegalEasyGrantBuilderException if with(activity: Activity)not called or called with a null value. If setCallback(callback: GrantCallbacks) is not called or called with null value. If none of the permissions are requested.

Multiple permission

EasyGrant.Builder()
        .withActivity(this)
        .withPermissions(permissionsList)
        .setCallback(this)
        .seek()

Usage

Dependency

Include the library in your app level build.gradle

dependencies{
    compile 'com.abhinavsharma:easygrant:0.0.5'
}

Do you want to contribute?

Feel free to add or suggest any useful feature to the library, I would be glad to improve it with your help.

Proudly 💪 made in Kotlin

License

Copyright 2017 Abhinav Sharma

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].