Feature flags (Android SDK)
WeavrComponentsFeatureFlags exposes runtime flags that alter SDK behaviour. Use the setter methods rather than assigning values directly — they apply thread-safety and environment-safety guards automatically.
mockBiometrics (sandbox only)
Replaces the system BiometricPrompt with a custom dialog, making biometric flows automatable in UI tests. Default: false.
WeavrComponentsFeatureFlags.setMockBiometrics(true)
The mock dialog presents Pass, Reject, Not enrolled, Not available, and Cancel actions for your tests to drive.
Usage
Call setMockBiometrics(true) after UXComponents.initialize(). The typical place is your Application class so mock mode is active for the entire test session:
override fun onCreate() {
super.onCreate()
UXComponents.initialize(this, ENV.SANDBOX, UI_KEY)
WeavrComponentsFeatureFlags.setMockBiometrics(true)
}
To scope it to individual tests, turn it on in @Before and turn it off in @After:
@Before
fun setUp() {
WeavrComponentsFeatureFlags.setMockBiometrics(true)
}
@After
fun tearDown() {
WeavrComponentsFeatureFlags.setMockBiometrics(false)
}
If the active environment is ENV.PRODUCTION, calls to setMockBiometrics(true) are silently ignored and the flag is reset to false. The same reset applies automatically when UXComponents.initialize() is called with ENV.PRODUCTION while the flag is already on.