Task (Recents) management on Android

We’re using WebAuthClient to handle sign in/out for an Android app, and generally we have it working well. There are some issues, however, with the custom Chrome window that gets created, specifically with its presence on the system Recents UI.

One scenario is the basic “happy path”:

  1. User opens our app and is not authenticated, so we invoke webAuth.signIn()
  2. Okta opens the custom Chrome sign-in window
  3. User signs in
  4. Control returns to our app, and we show our post-authentication UI

So far, so good. But at this point, the Okta sign-in window remains on the system task list. The user can switch back to it with their Recents button/gesture, or even return to it by just using the Back button from our app. But since they’re already signed in, that window is useless. Not a good UX.

Is there any way to tell Okta to remove it from the task list when it’s done, or maybe even excludeFromRecents in the first place? Or another way to handle the situation; I’m open to suggestions.

Tested on Android 11 (SDK 30) , and FWIW here are my Okta my build.gradle dependencies:

implementation 'com.okta.authn.sdk:okta-authn-sdk-api:1.0.0'
implementation('com.okta.authn.sdk:okta-authn-sdk-impl:1.0.0') {
    exclude group: 'com.okta.sdk', module: 'okta-sdk-httpclient'
implementation 'com.okta.sdk:okta-sdk-okhttp:1.5.4'
implementation 'com.okta.android:oidc-androidx:1.0.17'

this sounds like a request that can be included as a possible enhancement for the SDK

So I guess there’s no better way to handle it in the current version. :confused: