protected void requestPermission ( String [ ] permissions , int code ) { if ( Build . VERSION . SDK_INT >= 23 ) { List < String > deniedPermissions = getDeniedPermissions ( this , permissions ) ; if ( deniedPermissions . isEmpty ( ) ) { onPermissionGranted ( code ) ; } else { permissions = new String [ deniedPermissions . size ( ) ] ; deniedPermissions . toArray ( permissions ) ; ActivityCompat . requestPermissions ( this , permissions , code ) ; } } else { onPermissionGranted ( code ) ; } }
Request permission .