-
Notifications
You must be signed in to change notification settings - Fork 235
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
Crash on VenmoClient and venmoListener initilize after Fragment/Activity onResume. #732
Comments
I know..what you guys gonna suggest.. Definitely not possible to initialize braintree client before we open up bottomsheet or any such tricks!! |
Hi @sreereddymenon thanks for using the Braintree SDK for Android. Have you taken a look at ClientTokenProvider? This is a known limitation in our SDK because we use the Activity Result API internally, and it has the same restriction. We are working on a solution for this in our next major version to remove this restriction. Another option would be to fetch a client token and forward it to your in progress activity via Intent extras. It's a bit much, but it's a viable workaround. Let me know if any of the above helps. |
@sshropshire Got it!! Thats not possible with our current app architecture. I have started initializing the VenmoClient without passing the fragment/activity instance.
} and then handling the onactivityresult ourselves using
this implementation is working well and I have no idea if we do have any consequences/drawbacks.. Thank you!! |
Ok the deprecated methods are still covered by our unit tests so there shouldn't be any drawbacks. We've considered removing deprecation for some methods, but we may hold off until the beta to avoid confusion with new merchants onboarding. I'll keep this open for tracking until our initial beta removes this restriction. |
Hey @sreereddymenon! We just released a beta for the next major version, v5. In this new version, the v5 Venmo Migration Guide: https://github.com/braintree/braintree_android/blob/main/v5_MIGRATION_GUIDE.md#venmo |
Hi @sreereddymenon - Just wanted to keep you in the loop - we just released the GA version of v5! Releases: https://github.com/braintree/braintree_android/releases/tag/5.0.0 |
Braintree SDK Version
4.28.0
Environment
Sandbox
Android Version & Device
Google Pixel 3
Braintree dependencies
Describe the bug
Let me describe the scenario,
Our app consists of single activity approach, our app is a single activity with multiple modules/multiple fragments(NavGraph).....
we have a bottomsheet where we show
Add Venmo
Button, Upon clicking on that button, we initialize BraintreeClient by fetching clientToken (we showprogressIndiactor
while fetching it) from our server. once we have the token, we callCrash Log
FATAL EXCEPTION: main
Process: com.sei.android, PID: 9661
java.lang.IllegalStateException: LifecycleOwner MainActivity@45d7e5b is attempting to register while current state is RESUMED. LifecycleOwners must call register before they are STARTED.
at androidx.activity.result.ActivityResultRegistry.i(ActivityResultRegistry.java:123)
at com.braintreepayments.api.VenmoLifecycleObserver.d(VenmoLifecycleObserver.java:34)
at androidx.lifecycle.b0$b.a(LifecycleRegistry.kt:314)
at androidx.lifecycle.b0.a(LifecycleRegistry.kt:192)
at com.braintreepayments.api.t3.h(VenmoClient.java:95)
at com.braintreepayments.api.t3.(VenmoClient.java:89)
at com.braintreepayments.api.t3.(VenmoClient.java:66)
at com.braintreepayments.api.t3.(VenmoClient.java:52)
To reproduce
Initilize venmoClient after fragment is resumed
Expected behavior
It shouldn't crash
Screenshots
No response
The text was updated successfully, but these errors were encountered: