Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle process death/re-creation on Android properly #151

Open
RyanNewsom opened this issue Mar 31, 2021 · 10 comments
Open

Handle process death/re-creation on Android properly #151

RyanNewsom opened this issue Mar 31, 2021 · 10 comments
Assignees
Labels
enhancement New feature or request

Comments

@RyanNewsom
Copy link

RyanNewsom commented Mar 31, 2021

The problem

Android may kill activities when users background an app if the phone is currently resource constrained. To the user though, they simply backgrounded the app, and when they foreground the app, the state should be properly restored. This is not being handled properly for the Plaid SDK.

Actual:

  • User is trying to link their bank account, and has to do 2fa
  • User backgrounds our app (currently showing Plaid)
  • User goes to messages app, copies 2fa
  • User comes back to our app, and Plaid state has been reset, so they end up in this endless loop of re-logging into their bank, getting 2fa, exiting app, coming back to state loss...
    You can observe this use case in the video I have attached. If you would like to test, turn on DO NOT KEEP ACTIVITIES in developer options

Expected:
When a user background our app and is in Plaid and the OS kills the activity, upon recreation, plaid should resume its previous state.

Environment

Android OS Version Android 11
Android Devices/Emulators Pixel 3 XL

Steps to Reproduce

If necessary, describe the problem you have been experiencing in more detail.
Please include the configuration you are using for Link (exluding your keys
and personally identifiable information)

Link Android SDK 3.2.6
I'm launching your SDK like so:
Plaid.create(requireActivity().application, link).open(requireActivity())

  1. Turn on do not keep activities
  2. Launch Plaid, nav to a bank
  3. Background app
  4. Launch a different app
  5. Come back to app that had Plaid showing
  6. Observe that Plaid state is lost

Expected Result

Plaid should restore the users state and returning them to where they were.

Video

plaidIssue.mp4

Logs

Any relevant logs from Android Logcat or the iOS console including stacktraces.

Code To Reproduce Issue

Use your sample app, I bet it reproduces there too.

@zsweigart zsweigart added the enhancement New feature or request label Apr 5, 2021
@zsweigart zsweigart self-assigned this Apr 5, 2021
@zsweigart
Copy link
Contributor

Hi @RyanNewsom
Thanks for this feedback. Currently the SDK is showing a webview and our web implementation does not allow us to continue partway through the flow, except in the OAuth redirect case. You can test this by selecting Platypus OAuth Bank which will redirect out to a browser. Selecting one of the options to grant access, deny access or simulate error will redirect back to the application and on continue the flow at that point.

We agree that this is important functionality and are currently working on building it so it should be available in a future release.

@RyanNewsom
Copy link
Author

Thanks for the reply @zsweigart. Here is how you can save/restore a WebView in Android.
https://stackoverflow.com/questions/39086084/save-webview-state-on-screen-rotation

@RyanNewsom
Copy link
Author

@zsweigart are you guys working on this? I had an old co worker at a different company reach out to see if I found a resolution to this because they are seeing the same problem. Only option would be to fork your sdk and patch it ourselves. Thanks

@amytang0
Copy link
Contributor

Hi Ryan, apologies for the staleness of the issue, OAuth has specifically been resolved in 3.4.1 and the issue with saving a user's place in the Link flow has been resolved and will be in our 3.5.0 release (and release candidate).

@amytang0 amytang0 self-assigned this Jul 30, 2021
@amytang0
Copy link
Contributor

amytang0 commented Aug 13, 2021

Hi Ryan, apologies, our QA ran through 3.5.0 with the DNKA flag off, and thus it looked like the issue was resolved, when in reality it was not. Unfortunately the helpful suggestion you gave earlier about saving WebView state doesn't quite work with our implementation, as the Bundle the WebView state provides is not actually sufficient to restore the correct state of the Link Flow.

We are working on a fully native flow where process death will be handled correctly.

@RyanNewsom
Copy link
Author

Thanks for the update @amytang0

@amytang0
Copy link
Contributor

amytang0 commented Oct 26, 2021

If you would like to opt-in to the fully native experience, please upgrade to the latest version 3.6.1 and email your client_id to [email protected]

@RyanNewsom
Copy link
Author

@amytang0 how stable is the fully native experience?

@djMax
Copy link

djMax commented Aug 21, 2022

I think this is still happening in React Native usage of the Plaid SDK. When the app is backgrounded with the Plaid SDK showing, it will kill the react-native MainActivity and then be forced to restart the app from scratch.

@RyanNewsom
Copy link
Author

RyanNewsom commented Aug 23, 2022

@djMax this has not been resolved, hence the open state. The recommended solution is to switch to their native sdk which (hopefully) has this resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants