AI-generated Key Takeaways
-
Wallet is the main entry point for integrating the Wallet library and requires building a GoogleApiClient with appropriate Wallet.WalletOptions.
-
You must call GoogleApiClient.connect() and wait for the onConnected callback before using Wallet APIs.
-
It is recommended to instantiate GoogleApiClient in your Activity's onCreate, connect in onStart, and disconnect in onStop.
-
You can obtain instances of PaymentsClient or WalletObjectsClient using the static get methods with an Activity or Context and Wallet.WalletOptions.
The main entry point for Wallet library integration. You need to build a GoogleApiClient
using the API and the
appropriate Wallet.WalletOptions.
Once you have called GoogleApiClient.connect()
and your listener has received the
GoogleApiClient.ConnectionCallbacks#onConnected(android.os.Bundle) callback,
then you can call the various Wallet APIs.
When your app is done using Wallet, call GoogleApiClient.disconnect(),
even if the async result from GoogleApiClient.connect()
has not yet been delivered.
You should instantiate an instance of GoogleApiClient
in your Activity's Activity.onCreate(Bundle)
method and then call GoogleApiClient.connect()
in Activity.onStart()
and GoogleApiClient.disconnect()
in Activity.onStop(),
regardless of the state.
For comments and requirements specific to different Wallet APIs, please see each API interface's header comments.
Nested Class Summary
| class | Wallet.WalletOptions | Options for using the Wallet API. | |
Constant Summary
| String | API_NAME |
Field Summary
| public static final Api<Wallet.WalletOptions> | API | Add this to your GoogleApiClient
via
GoogleApiClient.Builder.addApi(Api extends Api.ApiOptions.NotRequiredOptions>
) to enable Wallet features. |
| public static final ClientKey<WalletClientImpl> | CLIENT_KEY |
Public Method Summary
| static PaymentsClient |
getPaymentsClient(Activity
activity, Wallet.WalletOptions
options)
Create a new instance of
PaymentsClient
for use in an Activity.
|
| static PaymentsClient |
getPaymentsClient(Context
context, Wallet.WalletOptions
options)
Create a new instance of
PaymentsClient
for use in a non-Activity Context.
|
| static WalletObjectsClient |
getWalletObjectsClient(Activity
activity, Wallet.WalletOptions
options)
Create a new instance of
WalletObjectsClient
for use in an Activity.
|
Inherited Method Summary
Constants
public static final String API_NAME
Fields
public static final Api<Wallet.WalletOptions> API
Add this to your GoogleApiClient
via
GoogleApiClient.Builder.addApi(Api extends Api.ApiOptions.NotRequiredOptions>
) to enable Wallet features.
To configure additional Wallet options, provide a Wallet.WalletOptions
object to
GoogleApiClient.Builder.addApi(Api extends Api.ApiOptions.NotRequiredOptions>
).
public static final ClientKey<WalletClientImpl> CLIENT_KEY
Public Methods
public static PaymentsClient getPaymentsClient (Activity activity, Wallet.WalletOptions options)
Create a new instance of PaymentsClient
for use in an Activity.
Parameters
| activity | is the caller's activity. |
|---|---|
| options | are the Wallet.WalletOptions
for configuring the API. |
public static PaymentsClient getPaymentsClient (Context context, Wallet.WalletOptions options)
Create a new instance of PaymentsClient
for use in a non-Activity Context.
Parameters
| context | is the caller's (Application)Context. |
|---|---|
| options | are the Wallet.WalletOptions
for configuring the API. |
public static WalletObjectsClient getWalletObjectsClient (Activity activity, Wallet.WalletOptions options)
Create a new instance of WalletObjectsClient
for use in an Activity. This
client should not be used outside of the given activity.