Giter VIP home page Giter VIP logo

ezpermission's Introduction

EzPermission Download

A tiny and easy to use kotlin library for managing android runtime permissions


NOTE:

This library is no longer maintained, Android standard api does the magic: https://developer.android.com/training/permissions/requesting


Gradle setup

Make sure you have jitpack repository in the project level build.gradle:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Then add dependency to the module:

dependencies {
        implementation 'com.github.FarshadTahmasbi:EzPermission:0.1.4'
}

How to use

It's simple, pass all permissions you want to ask for, the result will be divided into: granted, denied and permanently denied!

EzPermission.with(context)
    .permissions(
        Manifest.permission.WRITE_EXTERNAL_STORAGE,
        Manifest.permission.ACCESS_FINE_LOCATION
    )
    .request { granted, denied, permanentlyDenied ->
        //Here you can check results...
    }

⭐️ If you liked it support me with your stars!

License

Copyright 2019 Farshad Tahmasbi

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.    

ezpermission's People

Contributors

farshadtahmasbi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ezpermission's Issues

Calling startActivity() from outside of an Activity

When I'm trying to grant permission(s), a runtime exception occurred that says calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.

minimumSdkVersion = 23
compileSdkVersion = 28
targetSdkVersion = 28

Snipped code to request permission(s):

EzPermission.with(applicationContext)
            .permissions(
                Manifest.permission.WRITE_EXTERNAL_STORAGE,
                Manifest.permission.ACCESS_FINE_LOCATION
            )
            .request { granted, denied, permanentlyDenied ->
                granted.forEach { permission -> Log.w("Granted Permission", permission) }
                granted.forEach { permission -> Log.w("Denied Permission", permission) }
                granted.forEach { permission -> Log.w("Permanently Denied", permission) }
            }

Memory Leak

I love the library, very clean implementation. However, if you implement LeakCanary it will call a memory leak heap every time you ask for permissions due to the callback as soon as you go into the background or rotate to landscape mode.

Maybe there is no better way since you are kinda doing the hack of secretly adding an invisible screen to handle the permissions (which I love this) but maybe fixing the memory leak is not possible.

But if it is, that would be awesome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.