Sensitive Screens¶
Part of the Human Scoring use case.
Pause capture while sensitive input is on screen, such as a password, a card number or a one-time code. While paused, the SDK records nothing. The session continues, and capture picks up where it left off when you resume.
The SDK does not read key events or text, and touches on the system keyboard are not captured:
the keyboard is not your app's window. Touches on a PIN pad or a keyboard your app draws itself
are captured, so pause on those screens. If your app reports key presses with
captureKey, never report them for a password field.
When to use it¶
- A login or PIN screen is open
- A payment form is open
- Any screen your privacy policy says is not recorded
Prerequisites¶
- The SDK is installed and initialized. See the Quick Start.
Usage¶
Pause and resume¶
- Always pair
pause()withresume(). Time spent paused adds no actions, so a session left paused never becomes sufficient and its classification staysINSUFFICIENT. resume()does not override consent: if the user has not agreed, nothing is recorded after resuming either.- Call both on the main thread.
Note:
pause()andresume()do not nest. Oneresume()restarts capture however many timespause()was called, so two parts of your app that pause on their own interfere: the first one to resume restarts capture while the other still shows sensitive content. Give pausing one owner, or count the pauses yourself and callresume()only when the count is back to zero.
Examples¶
Pause for as long as an activity is in the foreground¶
import ai.dea.sdk.DeaSdk
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class PaymentActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_payment)
}
override fun onResume() {
super.onResume()
DeaSdk.instance?.pause()
}
override fun onPause() {
DeaSdk.instance?.resume()
super.onPause()
}
}
Pause while a fragment's view exists¶
import ai.dea.sdk.DeaSdk
import android.os.Bundle
import android.view.View
import androidx.fragment.app.Fragment
class PinFragment : Fragment(R.layout.fragment_pin) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
DeaSdk.instance?.pause()
}
override fun onDestroyView() {
DeaSdk.instance?.resume()
super.onDestroyView()
}
}
Pause while a password field has focus¶
import ai.dea.sdk.DeaSdk
import android.widget.EditText
fun EditText.pauseDeaWhileFocused() {
setOnFocusChangeListener { _, hasFocus ->
if (hasFocus) DeaSdk.instance?.pause() else DeaSdk.instance?.resume()
}
}
// In your activity or fragment:
// findViewById<EditText>(R.id.password).pauseDeaWhileFocused()
If the screen can close while the field still has focus, call resume() when it closes too.
API¶
| Member | Returns | Description |
|---|---|---|
pause() |
Unit |
Stops recording. The session is kept |
resume() |
Unit |
Starts recording again |