PlaceAutocomplete

public class PlaceAutocomplete extends Object

This class is deprecated.
The Google Play Services Places SDK is deprecated. A new SDK is available. See the client migration guide for more information.

PlaceAutocomplete provides an activity that allows a user to start typing a place name or an address and see place predictions appear as they type.

Users are expected to choose one of the predictions. Unlike PlacePicker, users only see a list of places, and not a full map. See the developer's guide for more details.

If the user exits the autocomplete activity without choosing a place, the calling activity will receive RESULT_CANCELED.

Nested Class Summary

class PlaceAutocomplete.IntentBuilder Builder for a Place Autocomplete launch intent. 

Constant Summary

int MODE_FULLSCREEN Mode for launching the autocomplete activity in fullscreen.
int MODE_OVERLAY Mode for launching the autocomplete activity as an overlay.
int RESULT_ERROR Indicates that an error occurred.

Public Method Summary

static Place
getPlace(Context context, Intent intent)
Returns the Place selected by the user.
static Status
getStatus(Context context, Intent intent)
Returns the Status associated with the result.

Inherited Method Summary

Constants

public static final int MODE_FULLSCREEN

Mode for launching the autocomplete activity in fullscreen. The app will no longer be visible while the user picks a place.

Constant Value: 1

public static final int MODE_OVERLAY

Mode for launching the autocomplete activity as an overlay. The app will be visible in the background while the user picks a place.

Constant Value: 2

public static final int RESULT_ERROR

Indicates that an error occurred.

When this result code is returned in onActivityResult(int, int, Intent), you should check the status returned by getStatus(Context, Intent).

Constant Value: 2

Public Methods

public static Place getPlace (Context context, Intent intent)

Returns the Place selected by the user.

Parameters
context Your application's context.
intent The result Intent that was provided in onActivityResult(int, int, Intent).
Returns
  • The user's selected Place.

public static Status getStatus (Context context, Intent intent)

Returns the Status associated with the result.

The list of possible status codes is available at PlacesStatusCodes.

You should pay specific attention to the value of getStatus(Context, Intent) when the activity's result code is RESULT_ERROR. This can indicate a configuration error (for example, an invalid API key in your Android manifest) or a quota error (see Usage Limits).

Parameters
context Your application's context.
intent The result Intent that was provided in onActivityResult(int, int, Intent).