Minimizing app during 3DS v1 causing library to reports 3DS cancelled event.
General information
- SDK/Library version:4.7.0
- Environment: all
- Android Version and Device: all
- Braintree dependencies:
implementation 'com.braintreepayments.api:card:4.6.0'
implementation 'com.braintreepayments.api:three-d-secure:4.6.0'
Issue description
As indicated in the title, the current implementation, documentation, and demo project contain a fundamental logical error.
Steps to reproduce
- Initiate 3DS v1
- Minimize application
- Open application
Expected result
The user sees the screen of entering the code that was when the application was minimized.
Actual result
Everything is broken an library returns the 3DS cancellation event.
Details
This is reproducable in the demo project. Here is a link to the video. The root of the problem is that you are tied to onResume lifecycle callback, which is fundamentaly wrong. It's absolutely normal for the user to minimize application, for example, to open an SMS with the confirmation code. But in the current implementation it's impossible.
Hi @v-sulimov thanks for using the Braintree SDK for Android. In the repro steps, we return to the Android home screen and then launch the Braintree demo app using the Launcher. The launcher creates a new intent that clears the chrome custom tab from the back stack and replaces it with the single DemoActivity. The 3D Secure flow should work fine during general multi-tasking.
We use onResume because Chrome Custom Tab at the moment doesn't provide access to a "close" event when the X button in the top left is pressed.
@sshropshire Do I understand correctly that when we minimize the application and return to it through the launcher, we will always get this behavior?
@v-sulimov yes selecting the app from the launcher screen will cause Android to launch the activity with category android.intent.category.LAUNCHER (specified in AndroidManifest.xml).
Since the application is already running, it pops the back stack until it reaches the target launcher activity, which in turn implicitly removes the Chrome Custom Tab / 3DS Verification activity.
We have taken note of this it is a valid concern. The unfortunate piece here is the limitation on Chrome Custom Tabs.
Last question, why in the version 3.x.x of the library this problem doesn't exist? And what the heck is deal with this? Are you really think that this is OK from the user experience perspective to drop the verification process just because user minimize the application?
@v-sulimov this exists in the 3.x version as well. It is easier to recover from a user perspective though, since the CCT is launched as a separate task. This has its own problems though with process kill, so unfortunately there is no silver bullet solution to this issue.
closing this issue for inactivity. If you encounter a similar problem, please create a new issue. Thanks!