TaskResultContracts.GetPaymentData
Stay organized with collections
Save and categorize content based on your preferences.
A simple contract that returns a PaymentData
object.
This contract resolves a Task
created by the
Google Pay API that returns a PaymentData
object or null if there is an error.
Below is an example that uses this contract to return a PaymentData
result from a completed Task
object created by
the
PaymentsClient.loadPaymentData(PaymentDataRequest)
method:
// Use the contract to create an activity result launcher
val paymentDataLauncher = registerForActivityResult(GetPaymentData()) {
// Do something with the result (it: PaymentData?)
}
// Start the task operation and associate it with the activity launcher
val paymentDataTask: Task<PaymentData> = paymentsClient.loadPaymentData(request)
paymentDataTask.addOnCompleteListener(context, paymentDataLauncher::launch)
Public Constructor Summary
Inherited Method Summary
From class
androidx.activity.result.contract.ActivityResultContract
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`TaskResultContracts.GetPaymentData` is a contract that simplifies retrieving `PaymentData` objects from Google Pay API tasks."],["It handles the task resolution and returns a `PaymentData` object or null in case of errors."],["You can use it with an activity result launcher to obtain the `PaymentData` after completing a Google Pay task."],["The contract provides methods to parse the result and extract the `PaymentData` from the task."]]],[]]