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

Cannot Initialize DropInClient #1090

Closed
yosrri opened this issue Aug 1, 2024 · 3 comments
Closed

Cannot Initialize DropInClient #1090

yosrri opened this issue Aug 1, 2024 · 3 comments

Comments

@yosrri
Copy link

yosrri commented Aug 1, 2024

Braintree SDK Version

6.13.0

Environment

Sandbox

Android Version & Device

Samsung A52, Android 13

Braintree dependencies

implementation "com.braintreepayments.api:drop-in:6.13.0"

maven {
url "https://cardinalcommerceprod.jfrog.io/artifactory/android"
credentials {
username 'braintree_team_sdk'
password 'AKCp8jQcoDy2hxSWhDAUQKXLDPDx6NYRkqrgFLRc3qDrayg6rrCbJpsKKyMwaykVL8FWusJpp'
}

Describe the bug

Trying to use the drop in ui, i lateinit the dropInClient and implemented the DropInListener, requested a token from our backend, upon arrival of the token from the backend private fun configureDropInClient(token: String) { dropInClient = DropInClient(this, token) dropInClient.setListener(this)
the debugger is stopped at line dropInClient = DropInClient(this, token)
reporting an exception saying: "lifecycleowner signuppaymentfragment{112c298} (63f0e051-95cc-416e-b698-8ee3cefb3148 id=0x7f0a06cb) is attempting to register while current state is resumed. lifecycleowners must call register before they are started."

private fun launchDropIn() {
        val dropInRequest = DropInRequest()
        dropInRequest.isVenmoDisabled = true
        dropInRequest.isGooglePayDisabled = true
        dropInRequest.isCardDisabled = true
        dropInRequest.maskCardNumber = true
        dropInRequest.maskSecurityCode = true
        dropInClient.launchDropIn(dropInRequest)
    } 

i call this after it but it never reached it, except one time which was weird i was debugging

To reproduce

you just initialize the drop in token like i explained

Expected behavior

drop in client get initialized and paypal gatway browser opens

Screenshots

No response

@sshropshire
Copy link
Contributor

Hi @yosrri thanks for using the Braintree SDK for Android. Have you tried using a ClientTokenProvider instead? There's a limitation with DropInClient that requires it to be instantiated in onCreate() (or before the host Activity reaches a CREATED state). We're working on removing this constraint in our next beta. In the meantime, using a ClientTokenProvider will be the best solution.

Also, I'm going to close this issue since it's unrelated to this repo, which hosts our Core SDK. If using a ClientTokenProvider doesn't work, feel free to re-open this issue in our braintree/braintree-android-drop-in repo.

@yosrri
Copy link
Author

yosrri commented Aug 5, 2024

@sshropshire thank you, does the same limitation exists in the paypal with vault sdk?

@sshropshire
Copy link
Contributor

@yosrri for now yes. We do eliminate the restriction in the v5 beta of our Core SDK though (see MIGRATION_GUIDE). In v5 only PayPalLauncher needs to be instantiated in onCreate(). We'll be releasing a similar update for DropIn in the near future as well.

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

No branches or pull requests

2 participants