protected void requestPermission ( final PermissionModel model ) { new AlertDialog . Builder ( this ) . setTitle ( model . getTitle ( ) ) . setMessage ( model . getExplanationMessage ( ) ) . setPositiveButton ( "Request" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { if ( model . getPermissionName ( ) . equalsIgnoreCase ( Manifest . permission . SYSTEM_ALERT_WINDOW ) ) { permissionHelper . requestSystemAlertPermission ( ) ; } else { permissionHelper . requestAfterExplanation ( model . getPermissionName ( ) ) ; } } } ) . show ( ) ; }
internal usage to show dialog with explanation you provided and a button to ask the user to request the permission