Skip to content Skip to sidebar Skip to footer

Integrate New Permission In Android Marshmallow

As we all know some changes have been made in api level 23(Android Marshmallow) in which we have to request for some permissions at run time that is on dangerous level like camera,

Solution 1:

Android Marshmallow introduces an entirely new spin on application permissions,Users now have the ability to revoke runtime permissions whenever they desire. This means that you can’t assume the app has access to the permission, even if it had been granted previously. You can refer this lib or this guide.I Hope this will help you out.

Solution 2:

1) You can get all the permissions given in your app using android api functions.

2) Then you can make a constant HashMap of dangerous permissions (which you are calling granular i guess).

3) When you will get all the permissions of your app just compare each permission individually either is it present in Dangerous Permissions HashMap or not.

Happy Coding :)

Solution 3:

Requesting permission is quite monotonous. One have to check permission each and every time whenever you use. For simplicity you can use PermissionAcceptor-master library.

Almost all permission is included in this library.

You have to add few lines of code using PermissionAcceptor-master library like

new PermissionRequest(MainActivity.this,
        Permission.PERMISSION_CAMERA,
        PermissionCode.CODE_PERMISSION_CAMERA,
        R.string.permission_camera_rationale,
        R.string.permission_camera_denied,
        R.string.permission_enable_message, this)
        .checkPermission();

For more information, visit PermissionAcceptor-master.

Post a Comment for "Integrate New Permission In Android Marshmallow"