Add a checkbox in plugin options page and make it actually work

It looks like your checkbox state is saved in $options['afi_checkbox_field_0']. You can check this setting anywhere using the following code:

$options = get_option( 'afi_settings' );

if ( ! empty( $options['afi_checkbox_field_0'] ) ) {
    // Checkbox checked
} else {
    // Not checked
}