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

GooglePayComponent forces us to use the deprecated onActivityResult #771

Open
tonihuotari opened this issue Aug 25, 2022 · 3 comments
Open
Labels
Enhancement Indicates a new feature request

Comments

@tonihuotari
Copy link

tonihuotari commented Aug 25, 2022

We haven't used the deprecated onActivityResult in our app in some time, we use registerForActivityResult with ActivityResultContracts as Google recommends. Now when we added the Adyen SDK in order to support GooglePay the documentation made it pretty clear that onActivityResult needs to be used. The problem is that when onActivityResult is overridden on activity level, all existing activity result handling in our fragments stop working:

    private val launcher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
        // Result callbacks never called
    }

    private fun openPaymentOption() {
        launcher.launch(intent)
    }

Digging into the SDK it is clear that you are aware of this problem, this is from com.adyen.checkout.googlepay.GooglePayComponent lines 91-92

// TODO this forces us to use the deprecated onActivityResult. Look into alternatives when/if Google provides any later.
AutoResolveHelper.resolveTask(paymentsClient.loadPaymentData(paymentDataRequest), activity, requestCode);

SDK version: com.adyen.checkout:googlepay:4.7.1

Any progress with this? It would be very tedious from our side to revert back to using deprecated functions.

@jreij
Copy link
Collaborator

jreij commented Aug 25, 2022

Hi Toni, thanks for reaching out! Unfortunately we're as frustrated by this as you are, as this is the only place in our whole codebase where we still need to use the deprecated onActivityResult.

But the Google docs do not provide an alternative as you can see here and here and there are numerous questions about this to Google but they're all unanswered.

@tonihuotari
Copy link
Author

Thanks for the quick reply!

Definitely frustrating, but I do understand that we are in the same situation :(

@jreij jreij added the Enhancement Indicates a new feature request label Aug 31, 2022
@JlUgia
Copy link

JlUgia commented Jul 18, 2023

Hi @tonihuotari and @jreij.
We wanted to let you know that this is in our radar and we are looking into it.
In the meantime, there's a way to use the new Activity Result API with the Google Pay API, although it comes at the cost of losing the abstraction provided by the AutoResolveHelper -> see the proposed commit in the Google Pay sample app repo.

Our recommendation is to hold on until the update to the Google Pay SDK is published. If you prefer not to wait, you can use the solution above, keeping in mind that this will likely incur in a later change when our API is updated.
Hope this helps.

@OscarSpruit OscarSpruit mentioned this issue Jun 13, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Indicates a new feature request
Projects
None yet
Development

No branches or pull requests

3 participants