setObserveModeEnabled method

Future<bool> setObserveModeEnabled(
  1. bool enabled
)

Stops the device answering readers, and starts reporting their polling frames to onPollingFrames instead.

This is how an app sees a reader before deciding to be a card for it: nothing is transacted while observe mode is on, so the app can inspect the loop, show a prompt, or pick which credential to present, and only then let the exchange happen -- with setObserveModeEnabled false, or automatically through a filter registered with autoTransact.

Call setPreferredService with true first. Only the preferred service may change observe mode; a call from an app that is not it returns false rather than throwing, because that is an ordinary state to be in and not a defect.

registerAids is not a prerequisite -- an app can watch readers without offering to be a card. This call enables the plugin's emulation service by itself, because the platform will not make a disabled service the preferred one. That enablement is the same persistent component state registerAids describes, and unregisterAids is the way back from it either way; it returns false when there were no AIDs to remove, which is not a failure.

Throws a PlatformException with code unsupported_api_level below API 35.

Implementation

Future<bool> setObserveModeEnabled(bool enabled) => androidApi.hceSetObserveModeEnabled(enabled);