Android 6.0 multiple permissions

后端 未结 22 1851
太阳男子
太阳男子 2020-11-22 03:58

I know that Android 6.0 has new permissions and I know I can call them with something like this

if (ContextCompat.checkSelfPermission(this, Manifest.permiss         


        
22条回答
  •  情歌与酒
    2020-11-22 04:28

    Simple way to ask multiple permission,

    https://github.com/sachinvarma/EasyPermission

    How to add :

    repositories {
            maven { url "https://jitpack.io" }
        }
    
    implementation 'com.github.sachinvarma:EasyPermission:1.0.1'
    

    How to ask permission:

     List permission = new ArrayList<>();
     permission.add(EasyPermissionList.READ_EXTERNAL_STORAGE);
     permission.add(EasyPermissionList.ACCESS_FINE_LOCATION);
    
     new EasyPermissionInit(MainActivity.this, permission);
    

    For more Details - >

    https://github.com/sachinvarma/EasyPermission/blob/master/app/src/main/java/com/sachinvarma/easypermissionsample/MainActivity.java

    It may help someone in future.

提交回复
热议问题