java.lang.Object | |
↳ | com.google.android.gms.wallet.WalletClient |
The main entry point for Google Wallet integration.
Use the WalletClient after the asynchronous connect()
method
has been called and your listener's
onConnected(Bundle)
method is called.
When your app is done using WalletClient, call disconnect()
,
even if the async result from connect()
has not yet been
delivered.
You should instantiate this object in your Activity's
onCreate(Bundle)
method and then call connect()
in
onStart()
and disconnect()
in
onStop()
, regardless of the state.
To allow the user to select and change the account associated with the transaction and Google
transaction ID, use null
for the accountName parameter of the constructor. No special
action is required when a user changes the selected account through the UI in this case, and the
Google transaction ID associated with the transaction can continue to be used.
To specify the account and prevent the user from selecting another account, pass the account through the accountName parameter. To change the account, construct a new WalletClient with the new account and do not reuse the Google transaction ID associated with the old account - this is a new transaction.
We recommend that you apply for API access
before starting development. During development, use the sandbox environment by specifying
ENVIRONMENT_SANDBOX
in the constructor.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a Google Wallet client to connect to Google Play services.
| |||||||||||
Creates a Google Wallet client to connect to Google Play services.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
This method brings up a Google Wallet selector screen to allow your customer to select a new
payment instrument or shipping address from their Google Wallet.
| |||||||||||
This API checks to see if a user has previously authorized the application to access their
Wallet account.
| |||||||||||
Connects the client to Google Play services.
| |||||||||||
Closes the connection to Google Play services.
| |||||||||||
Checks if the client is currently connected to the service, so that
requests to other methods will succeed.
| |||||||||||
Checks if the client is attempting to connect to the service.
| |||||||||||
Returns true if the specified listener is currently registered to
receive connection events.
| |||||||||||
Returns true if the specified listener is currently registered to
receive connection failed events.
| |||||||||||
Requests a
FullWallet , which contains the payment credentials. | |||||||||||
If an application has authorization, loadMaskedWallet() allows you to skip the Google Wallet
selector and directly request the masked payment credentials.
| |||||||||||
Sends a notification to Google on whether the transaction succeeded or failed.
| |||||||||||
Registers a listener to receive connection events from this
GooglePlayServicesClient . | |||||||||||
Registers a listener to receive connection failed events from this
GooglePlayServicesClient . | |||||||||||
Removes a connection listener from this
GooglePlayServicesClient . | |||||||||||
Removes a connection failed listener from the
GooglePlayServicesClient . |
[Expand]
Inherited Methods | |||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||||||||||||||||||||||||
From interface
com.google.android.gms.common.GooglePlayServicesClient
|
Creates a Google Wallet client to connect to Google Play services.
activity | The Activity to use for the connection. |
---|---|
environment | The Google Wallet environment to use. Specify
ENVIRONMENT_SANDBOX until you have applied for and been
granted access to the Production environment. |
accountName | Google Account to use for this transaction. null lets the Wallet
SDK choose a default account. |
connectionCallbacks | The listener where the results of the asynchronous
connect() call are delivered. |
connectionFailedListener | The listener which will be notified if the connection attempt fails. |
Creates a Google Wallet client to connect to Google Play services.
activity | The Activity to use for the connection. |
---|---|
environment | The Google Wallet environment to use. Specify
ENVIRONMENT_SANDBOX until you have applied for and been
granted access to the Production environment. |
accountName | Google Account to use for this transaction. null lets the Wallet
SDK choose a default account. |
theme | specify a theme to use for Wallet running on Android OS with
SDK_INT
>= HONEYCOMB . The only legitimate values are
THEME_HOLO_DARK and THEME_HOLO_LIGHT
as those are the only supported themes. User-created themes are not supported.
Value ignored for Android OS with SDK_INT
< HONEYCOMB . |
connectionCallbacks | The listener where the results of the asynchronous
connect() call are delivered. |
connectionFailedListener | The listener which will be notified if the connection attempt fails. |
This method brings up a Google Wallet selector screen to allow your customer to select a new payment instrument or shipping address from their Google Wallet.
requestCode | will be passed back in onActivityResult where you can retrieve the result
via EXTRA_MASKED_WALLET .
|
---|
This API checks to see if a user has previously authorized the application to access their Wallet account.
requestCode | will be passed back in onActivityResult where you can retrieve the result
via EXTRA_IS_USER_PREAUTHORIZED .
|
---|
Connects the client to Google Play services. This method returns immediately, and connects to
the service in the background. If the connection is successful,
onConnected(Bundle)
is called. On a
failure, onConnectionFailed(ConnectionResult)
is called.
Closes the connection to Google Play services. No calls can be made on this object after calling this method.
Checks if the client is currently connected to the service, so that requests to other methods will succeed. Applications should guard client actions caused by the user with a call to this method.
Checks if the client is attempting to connect to the service.
Returns true if the specified listener is currently registered to receive connection events.
listener | The listener to check for. |
---|
Returns true if the specified listener is currently registered to receive connection failed events.
listener | The listener to check for. |
---|
Requests a FullWallet
, which contains the payment credentials. You can retrieve the
FullWallet
in onActivityResult
using the requestCode
that
you provide to this method. If there is a problem with the transaction then the Google Wallet
selector will be shown and a MaskedWallet
will be returned to reflect new selections
by the user.
This function should only be called when the customer confirms the purchase.
Important: Because the credentials are in plain text it is important to transfer the payment credentials following PCI standards.
requestCode | will be passed back in onActivityResult where you can retrieve the result
via EXTRA_FULL_WALLET or
EXTRA_MASKED_WALLET if the user had to make new
selections.
|
---|
If an application has authorization, loadMaskedWallet() allows you to skip the Google Wallet
selector and directly request the masked payment credentials. This provides a more seamless
purchase experience for your customers. When you call this method, the Google Wallet selector
will be shown only if necessary. Either way, you can retrieve the MaskedWallet
in
onActivityResult
using the specified requestCode
.
requestCode | will be passed back in onActivityResult where you can retrieve the result
via EXTRA_MASKED_WALLET .
|
---|
Sends a notification to Google on whether the transaction succeeded or failed. This should always be called after payment processing as well as any failed validation checks.
Registers a listener to receive connection events from this GooglePlayServicesClient
.
If the service is already connected, the listener's onConnected(Bundle)
method will be called immediately. Applications should balance calls to this method with
calls to unregisterConnectionCallbacks(ConnectionCallbacks)
to avoid leaking
resources.
If the specified listener is already registered to receive connection events, this
method will not add a duplicate entry for the same listener, but will
still call the listener's onConnected(Bundle)
method if currently
connected.
Note that the order of messages received here may not be stable, so clients should not rely on the order that multiple listeners receive events in.
listener | the listener where the results of the asynchronous connect() call are
delivered.
|
---|
Registers a listener to receive connection failed events from this
GooglePlayServicesClient
. Unlike registerConnectionCallbacks(GooglePlayServicesClient.ConnectionCallbacks)
, if the service
is not already connected, the listener's
onConnectionFailed(ConnectionResult)
method will not be called immediately.
Applications should balance calls to this method with calls to
unregisterConnectionFailedListener(OnConnectionFailedListener)
to avoid leaking
resources.
If the specified listener is already registered to receive connection failed events, this method will not add a duplicate entry for the same listener.
Note that the order of messages received here may not be stable, so clients should not rely on the order that multiple listeners receive events in.
listener | the listener where the results of the asynchronous connect() call are
delivered.
|
---|
Removes a connection listener from this GooglePlayServicesClient
. Note that removing
a listener does not generate any callbacks.
If the specified listener is not currently registered to receive connection events, this method will have no effect.
listener | the listener to unregister. |
---|
Removes a connection failed listener from the GooglePlayServicesClient
.
Note that removing a listener does not generate any callbacks.
If the specified listener is not currently registered to receive connection failed events, this method will have no effect.
listener | the listener to unregister. |
---|