Page Summary
-
The
Addressclass provides APIs for accessing a user's address. -
The
requestUserAddressmethod prompts the user to select an address to share with your application. -
The
Address.AddressOptionsclass encapsulates options for the Address APIs. -
The
APIfield is used to connect with Google Play Services viaGoogleApiClient.
APIs for accessing a user's address. Calling
requestUserAddress(GoogleApiClient, UserAddressRequest, int) will prompt the user
to select an address to share with your application.
Nested Class Summary
| class | Address.AddressOptions | A class that encapsulates options for the Address APIs. |
Field Summary
| public static final Api<Address.AddressOptions> | API | Add this to your GoogleApiClient
via
addApi(Api
). |
Public Constructor Summary
|
Address()
|
Public Method Summary
| static void |
requestUserAddress(GoogleApiClient
googleApiClient,
UserAddressRequest request, int requestCode)
API to request an address from a user.
|
Inherited Method Summary
Fields
public static final Api<Address.AddressOptions> API
Add this to your GoogleApiClient
via
addApi(Api
).
Public Constructors
public Address ()
Public Methods
public static void requestUserAddress (GoogleApiClient googleApiClient, UserAddressRequest request, int requestCode)
API to request an address from a user. This will invoke a dialog that allows the
user to decide if they want to select a single address to share your app, or
alternatively decline to share an address at all. The response to this request is
supplied via your Activity's
onActivityResult(int, int, Intent) callback method.
- If the user selects an address to share, a response code of
RESULT_OKis returned. You can retrieve theUserAddressfrom the data Intent sent toonActivityResult(int, int, Intent)using thefromIntent(android.content.Intent)key. - If the user declines to share an address, a response code of
RESULT_CANCELEDis returned. - If there is an error retrieving addresses for the user, for example if the user
has no applicable addresses, then a response code of
RESULT_ERRORis returned. You can retrieve the error code from the data Intent using theEXTRA_ERROR_CODEkey.
Parameters
| googleApiClient | used to communicate with Google Play Services. This should be configured to use
API.
Must not be null. |
|---|---|
| request | used to specify what kind of addresses your app can handle. You must pass in a
valid
UserAddressRequest created via
build(). |
| requestCode | used
onActivityResult(int, int, Intent) to identify which request triggered
that callback. |