private void askPermissions(){
  mPermissionsToAsk=getNotGrantedPermissions();
  if (mPermissionsToAsk.size() > 0 && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    requestPermissions(mPermissionsToAsk.toArray(new String[mPermissionsToAsk.size()]),MY_PERMISSION_REQUEST_ALL);
  }
 else {
    onClickAfterCheckPermissions();
  }
}

private void askPermissions ( ) { mPermissionsToAsk = getNotGrantedPermissions ( ) ; if ( mPermissionsToAsk . size ( ) > 0 && Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { requestPermissions ( mPermissionsToAsk . toArray ( new String [ mPermissionsToAsk . size ( ) ] ) , MY_PERMISSION_REQUEST_ALL ) ; } else { onClickAfterCheckPermissions ( ) ; } }
main function to ask permissions
