You're all set!

To start developing, please head over to our developer documentation.

Activate the Google Places API for Android

To get you started we'll guide you through the Google Developers Console to do a few things first:

  1. Create or choose a project
  2. Activate the Google Places API for Android
  3. Create appropriate keys
Continue

Place Add

You can use the Google Places API for Android to add a place to Google's Places database. The newly-added place is available to your app after a short time, and is added to a moderation queue for possible addition to Google's Places database and Google Maps.

Add a place

To add a place, call GeoDataClient.addPlace(), passing an AddPlaceRequest object that specifies the details of the place you want to add.

Include the following information when creating the AddPlaceRequest:

  • Required: The full textual name of the business, point of interest, or other place. Limited to 255 characters.
  • Required: A LatLng object specifying the location of the place.
  • Required: The human-readable address of the place. If a place has a well-formatted, human-readable address, it is more likely to pass the moderation process for inclusion in the Google Places database.
  • Required: A list of place types that characterize this place. For a list of available place types, see the documentation for Place Types and the constants defined in the Place interface.
  • Optional: The phoneNumber of the place. This is the phone number in international format. International format includes the country code, and is prefixed with the plus (+) sign. For example, the international phone number for Google's Mountain View, USA office is +1 650-253-0000. If a place has a well-formatted phone number, it is more likely to pass the moderation process for inclusion in the Google Places database. Note: You should provide either the phoneNumber or the Uri, or both.
  • Optional: A Uri object containing the address of the authoritative website for this place, such as a business home page. If a place has a well-formatted website address, it is more likely to pass the moderation process for inclusion in the Google Places database. Note: You should provide either the phoneNumber or the Uri, or both.

The API returns a PlaceBufferResponse in a Task.

The resulting Place object has a unique place ID, which your app can use from that point on to retrieve the place details. Added places are also available after a short time in the results of get-current-place requests initiated by your app, and in a place picker displayed by your app. Scoping is determined by the project ID used to generate your API key.

Newly-added places enter a moderation queue to be considered for addition to the Google Places database. Places that are not accepted by the moderation process will continue to be retrievable through the place ID in the app that submitted them, but will no longer appear in the results of get-current-place requests, the api picker, or any other API method. Places that pass moderation will be visible to all apps and on Google Maps.

To make it more likely that the place will pass the moderation process and be added to the Google Places database, the add request should include as much information as possible. In particular, the address, phone number and website are important.

The following code sample adds a wild life sanctuary near Manly on the east coast of Australia.

AddPlaceRequest place =
    new AddPlaceRequest(
            "Manly Sea Life Sanctuary", // Name
            new LatLng(-33.7991, 151.2813), // Latitude and longitude
            "W Esplanade, Manly NSW 2095", // Address
            Collections.singletonList(Place.TYPE_AQUARIUM), // Place types
            "+61 1800 199 742", // Phone number
            Uri.parse("http://www.manlysealifesanctuary.com.au/") // Website
    );

mGeoDataClient.addPlace(place).addOnCompleteListener(new OnCompleteListener<PlaceBufferResponse>() {
    @Override
    public void onComplete(@NonNull Task<PlaceBufferResponse> task) {
        PlaceBufferResponse places = task.getResult();
        Log.i(TAG, "Added place: " + places.get(0).getName().toString());
        places.release();
    }
});

Handle multiple place IDs and place ID scoping

Each place ID can refer to only one place, but a single place can have more than one place ID. The most common case for handling multiple IDs for a place is when you've added a place that's initially scoped to your app, and then receives a Google-wide scope.

When you add a place, you receive a place ID for the new place immediately. This place ID is scoped for your app only. The place then enters a moderation queue, awaiting approval for addition to the Google Places database. If approved, the place will receive a new place ID, available to all apps and on Google Maps.

When you request a place by specifying a place ID, you can be confident that you will always receive the same place in the response (if the place still exists).

Note, however, that the response may contain a place ID that is different from the one in your request. For more information, see the place ID overview.

Send feedback about...

location_on
Google Places API for Android