Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.51 KB

README.md

File metadata and controls

52 lines (38 loc) · 1.51 KB

Google Places API - Java

This is a lightweight Java wrapper of the Google Places API supporting common query actions including search, detail, and autocomplete.

Example Usage

Search Nearby

GooglePlaces places = new GooglePlaces( "API_KEY" );
PlacesResult result = places.searchNearby( 40.10744f, -88.22724f, 5000, PlacesQueryOptions.create( ).keyword( "siebel center" ) );
		
System.out.println( result.getStatus( ) );
for ( Place place : result )
	System.out.println( place.getName( ) + " " + place.getGeometry( ).getLocation( ) );

Search Text

GooglePlaces places = new GooglePlaces( "API_KEY" );
PlacesResult result = places.searchText( "Pizza in Champaign, IL" );

System.out.println( result.getStatus( ) );
for ( Place place : result )
	System.out.println( place.getName( ) + ", " + place.getFormattedAddress( ) );

Detail

GooglePlaces places = new GooglePlaces( "API_KEY" );
PlaceDetailResult result = places.detail( place.getPlaceId( ) );

Autocomplete

GooglePlaces places = new GooglePlaces( "API_KEY" );
AutocompleteResult result = places.autocomplete( "Siebel Ce" );
		
for ( Prediction p : result )
	System.out.println( p.getDescription( ) );

Dependencies

License

See the LICENSE file for rights and limitations under the terms of the MIT license.

Downloads

Source is hosted on GitHub.