Skip to content

Timeout Lock Service Documentation

The flows component of SAP SDK includes a feature that displays the sign-in screen when users bring the app back from the background after a certain period. Users need to unlock the app with a passcode before they can use it.

There may be cases where the client app wants to control whether the sign-in screen appears. For example, the client app might not want the sign-in screen to appear over the widget configuration activity or when switching back from another app.

To address these requirements, SAP SDK provides several APIs to assist customers.

Specify Activities

FlowActionHandler includes an open function that client code can override. For instance, if the client application does not want the sign-in screen to appear on top of the launcher or widget configuration activities, the following sample code can be used:

class DemoFlowActionHandler : FlowActionHandler() {
    override fun shouldStartTimeoutFlow(activity: Activity): Boolean = when (activity) {
        is WelcomeActivity -> false
        is ODataWidgetConfigurationActivity -> false
        else -> super.shouldStartTimeoutFlow(activity)
    }
}

Temporarily Set the Timeout Settings

To address the case where the app is switched back from another app, you can use the following API:

@JvmStatic
fun updateOnetimeTimeoutSetting(timeoutLockTime: Int) { ... }

As the function name suggests, the timeoutLockTime is used only once when the app is sent to the background after this call. After that, the timeout settings from the passcode policy will take effect. If timeoutLockTime is negative, the timeout service will be disabled.

This API is introduced in version 24.12 of SAP SDK.

Pause/Resume the Timeout Lock Service

Before the introduction of the API above, the following two APIs could be used to handle the case of returning from another app:

@JvmStatic fun pause() { ... }
@JvmStatic fun resume() { ... }

The client code must ensure that the service is resumed after calling pause. We recommend using the updateOnetimeTimeoutSetting method starting from version 24.12 of SAP SDK.


Last update: December 13, 2024