Advanced

Pausing the SDK

The SDK will start to show screens as soon as it's been initialised, and you've called sync. This means that if you had a user who has triggered "made_transaction" a few times, and whilst they were away from the app you put a screen live that shows based on that, as soon as they next open and you sync, it would show the screen you setup. Generally this behaviour is great and allows for you to show screens at the perfect time, but there's also times you'd like to prevent this.

For an example, if you're a finance app, you may wish to prevent content being shown until the user has entered a pin or triggered FaceID. This is what the pause function allows.

The pause function

The pause function prevents any automatic screens from being displayed. This includes all automatic screens, and in 1.14.0, it includes any screen triggered by the user opening a push notification.

Push

Pause will not prevent push notifications being sent to a user. If the SDK is paused and they tap on a push, the app will open/foreground, but nothing will happen. Be sure to remember this and resume the SDK as soon as possible.

Pausing is as simple as calling pause on the client. In our example above, this should be called as soon as the SDK is initialised ( as early as possible in your app ). Once the pin screen is dismissed, you should call resume.

UnflowSDK.client.pause()

The resume function

The resume function re-enables unflow to show any automatic screens. If a screen was queued up but not shown due to pause, calling resume will show that screen immeditaley.

UnflowSDK.client.resume()