GithubHelp home page GithubHelp logo

k0shk0sh / permissionhelper Goto Github PK

View Code? Open in Web Editor NEW
1.2K 45.0 228.0 1.82 MB

Android Library to help you with your runtime Permissions.

Home Page: http://k0shk0sh.github.io/PermissionHelper/

License: Apache License 2.0

Java 100.00%

permissionhelper's Issues

Hello,how to use it?

i had read your demo ,but i can't find what difference with using PermissionHelper and without it.

Camera access example

Seems easy enough:

protected void intentCamera()
{
    permissionHelper
        .setForceAccepting(false)
        .request(MULTI_PERMISSIONS); // CAMERA and WRITE_EXTERNAL_STORAGE

    showCamera();
}

But doesn't work as expected, as showCamera() is called regardless of the status of the permissions. Does showCamera() go into onRequestPermissionsResult()?

issue

If i disable the permission manually while running the app
(Go to the App Setting -> Disable the permission anything), our activity will have a problem.(Specifically, In a case that activity has fragments). I see that android kills the app in the circumstance.

Group Permissions

thank you for this library but how i can make the group request permission like this group
Manifest.permission_group.STORAGE

Allow button is not working in Nexus 5

Hello,

I have checked your code is working perfectly in Nexus 6P

But i have an issue of not press Allow button Properly in Nexus 5

Please check it.

Thanks,
Dixit Patel

Multiple permission

Hallo,

I want showing my Permissions like this. But my code doesn't work. It only show always the first permission of the list. Could you help me pls.

unbenannt

public final static String WRITE_EXTERNAL_STORAGE_PERMISSION = Manifest.permission.WRITE_EXTERNAL_STORAGE;
public final static String ACCESS_FINE_LOCATION_PERMISSION = Manifest.permission.ACCESS_FINE_LOCATION;
public final static String CAMERA_PERMISSION = Manifest.permission.CAMERA;

public final static String[] MULTIPLE_PERMISSIONS = {WRITE_EXTERNAL_STORAGE_PERMISSION,
            ACCESS_FINE_LOCATION_PERMISSION,
            CAMERA_PERMISSION};
permissionHelper.setForceAccepting(false)
                .request(PermissionsStatesHelper.MULTIPLE_PERMISSIONS);

When the permission(s) granted, can't know which action request the permission(s).

For Example:
In an Activity, there are two actions(download, take photos) that request Manifest.permission.WRITE_EXTERNAL_STORAGE.

Before start download action, request the permission, and then the permission is granted.
Now, What to do next? (Notice that taking photos also require and request the permission.)

The next step is to download or to take photos?

Something went wrong with release .10

The uploaded artifacts (source and aar) have the request method in base with the == not the latest >= on the sdk check..

Looks a bit like the wrong artifact got uploaded. the release zip is fine..

onNoPermissionNeeded

You should provide a parameter in onNoPermissionNeeded method to distinguish multiple permissions callback;

PermissionModelBuilder in ActivityMain?

Can you post an example of how to reference an array element from SamplePagerActivity in SampleActivity? I am trying to customize the boxes, but when I call

permissionHelper .setForceAccepting(false) .request(MULTI_PERMISSIONS);

No customizations appear. Just the default alerts.

Multiple permissions

@k0shk0sh This problem still exists in Android 6.0.1.
I am using v1.0.11 but still not getting expected multiple permissions.. it shows only first permission from list. and if first permission is granted then only it displays next one.. but it is not showing non granted permissions in queue.. as shown in images above by @drchopper
i have tried as said in #10 this issue but dint worked for me

Displaying wrong PermissionModel

Look at the screenshot.

You vcan see the permission is android.permission.GET_ACCOUNTS

And the PermissionModel is for android.permission.ACCESS_FINE_LOCATION

2016-02-18_13h03_21

My PermissionModel is defined like this for testing

    List<PermissionModel> permissions = new ArrayList<>();
    permissions.add(PermissionModelBuilder.withContext(this)
            .withTitle("ACCESS_FINE_LOCATION")
            .withCanSkip(false)
            .withPermissionName(Manifest.permission.ACCESS_FINE_LOCATION)
            .withMessage("PermissionHelper also prevents your app getting crashed if the " +
                    "requested permission never exists in your AndroidManifest" +
                    ". Android DOES!")
            .withExplanationMessage("We need this permission to access to your location to" +
                    " find nearby restaurants and places you like!")
                    //.withFontType("my_font.ttf")
            .withLayoutColorRes(R.color.primary_color)
            .withImageResourceId(R.drawable.logo_image)
            .build());

    permissions.add(PermissionModelBuilder.withContext(this)
            .withTitle("GET_ACCOUNTS")
            .withCanSkip(true)
            .withPermissionName(Manifest.permission.GET_ACCOUNTS)
            .withTitle(R.string.title_get_accounts)
            .withMessage(R.string.message_get_accounts)
            .withExplanationMessage(R.string.explanation_message_get_accounts)
                    //.withFontType("my_font.ttf")
            .withLayoutColorRes(R.color.primary_color)
            .withImageResourceId(R.drawable.logo_image)
            .build());

    permissions.add(PermissionModelBuilder.withContext(this)
            .withTitle("READ_CONTACTS")
            .withCanSkip(true)
            .withPermissionName(Manifest.permission.READ_CONTACTS)
            .withTitle("READ_CONTACTS")
            .withMessage(R.string.message_get_accounts)
            .withExplanationMessage(R.string.explanation_message_get_accounts)
                    //.withFontType("my_font.ttf")
            .withLayoutColorRes(R.color.primary_color)
            //.withImageResourceId(R.drawable.permission_three)
            .build());

    permissions.add(PermissionModelBuilder.withContext(this)
            .withTitle("WRITE_CONTACTS")
            .withCanSkip(true)
            .withPermissionName(Manifest.permission.WRITE_CONTACTS)
            .withTitle("WRITE_CONTACTS")
            .withMessage(R.string.message_get_accounts)
            .withExplanationMessage(R.string.explanation_message_get_accounts)
                    //.withFontType("my_font.ttf")
            .withLayoutColorRes(R.color.primary_color)
                    //.withImageResourceId(R.drawable.permission_three)
            .build());

    permissions.add(PermissionModelBuilder.withContext(this)
            .withTitle("WRITE_EXTERNAL_STORAGE")
            .withCanSkip(true)
            .withTitle("WRITE_EXTERNAL_STORAGE")
            .withPermissionName(Manifest.permission.WRITE_EXTERNAL_STORAGE)
            .withMessage("PermissionHelper lets you customize all these stuff you are seeing!." +
                    " if you ever thought of anything that improves the library please" +
                    " suggest by filling up an issue in github https://github.com/k0shk0sh/PermissionHelper")
            .withExplanationMessage("We need this permission to save your captured images and videos to your SD-Card")
                    //.withFontType("my_font.ttf")
            .withLayoutColorRes(R.color.black)
            .withImageResourceId(R.drawable.logo)
            .build());

    permissions.add(PermissionModelBuilder.withContext(this)
            .withTitle("SYSTEM_ALERT_WINDOW")
            .withCanSkip(false) /*explanation only once will be called otherwise we will
                        run into infinite request if the user never grant the permission.*/
            .withTitle("SYSTEM_ALERT_WINDOW")
            .withPermissionName(Manifest.permission.SYSTEM_ALERT_WINDOW)
            .withMessage("PermissionHelper handles requesting SYSTEM_ALERT_WINDOW permission")
            .withExplanationMessage("We need this permission to make our videoPlayer overlay on your screen.")
            //.withFontType("my_font.ttf")
            .withLayoutColorRes(R.color.primary_color)
            .withImageResourceId(R.drawable.logo_image).build());

    return permissions;

Notification Access Permissions

Hey, it would be awesome if you could implement support for android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS. This is similar to the system alert window permission in that you need to go to settings to change it.

Close when deny or allow pressed

My app is closed when I press deny or allow, is there any solution to that?

EDIT: my bad, I've android:noHistory="true" in manifests

create a new release.

Is it possable to get a new release with the change that fixes the version check on the release call?

Just tried my app on android V24 and it failed to popup the permission because of this..

Implementation help

PermissionsActivity.java.zip

hey im trying to implement your pager example and apparently i didi everything right but and i click the check button a request popup show and not a permission popup mu code is attached could you help me out

Rquest without Callback

Hi,

is it possible to set a request without using the OnPermissionCallback.

Like this:


boolean isGranted = permissionHelper
     .setForceAccepting(false)// true if you had like force reshowing the permission dialog on Deny (not recommended)
     .request(isSingle ? SINGLE_PERMISSION : MULTIPLE_PERMISSIONS);

if user declined (boolean = false) -> ask next time again
if user really declined (boolean = false) - > open a dialog with "open Settings" buttom
if user granted (boolean = true) - > do nothing

do you know what i mean?

cheers

[Feature request] Create slide without permission

The slider thing is great but it would be cooll if we can add a slide that does not ask for permission.

atm if i build a slide without calling withPermissionName it crash
java.lang.IllegalArgumentException: Unknown permission: null

Null Pointer

Hi,

I have implemented PermissionHelper and rolled out my APK. I tested it with several phones before release, but now I get dozens of crash of my users.

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'int android.content.Context.checkPermission(java.lang.String, int, int)' on a null object reference

com.fastaccess.permission.base.PermissionFragmentHelper.isPermissionDeclined (PermissionFragmentHelper.java:348)

I use it in Fragments. Maybe context is losing it's state somehow? So we would need to check context for null?! The crash happens only on Android 8 devices. Update: Now I saw it also on Android 7.1.1

How to handle that?

Requesting WRITE_SETTINGS permission

First of all thank you for this great library. However in my app I need to get WRITE_SETTINGS permission and I use following block of code.

permissions.add(PermissionModelBuilder.withContext(this)
.withCanSkip(false)
.withPermissionName(Manifest.permission.WRITE_SETTINGS)
.withTitle("CHANGE BRIGHTNESS SETTINGS")
.withMessage("This permission is required for this app to change brightness settings of this device.")
.withExplanationMessage(R.string.explanation_message_get_settings)
.withFontType("my_font.ttf")
.withLayoutColorRes(R.color.colorPrimary)
.withImageResourceId(R.drawable.permission_three)
.build());

This does not prompt me to get system settings and it simply skip to next page (using SamplePagerActivity).

I have defined uses-permission android:name="android.permission.WRITE_SETTINGS" in Manifest file as well.

Do you have any idea why? Appreciate your help. Thanks.

No onPermissionNeedExplanation when requested with multiple permission

When I try to request multiple permission and user has already denied them once, it is supposed to call onPermissionNeedExplanation but it doesn't do that but this works fine it I call one permission at a time.
Please fix this issue.

Edit:
Even if I request each permission one by one it shows onPermissionNeedExplanation for only first one and for others it requests permission i.e onPermissionNeedExplanation and permission dialog gets overlapped.

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.