Four basic Place requests are available from the API:
Place Searches return a list of nearby Places based on a user's location or search string.
Place Details requests return more detailed information about a specific Place, including user reviews.
Place Actions allow you to supplement the data in Google's Places Database with data from your application. Place Actions allow you to schedule Events, weight Place rankings by check-in data, or add and remove Places.
Places Autocomplete can be used to provide autocomplete functionality for text-based geographic searches, by returning Places as you type.
Note: The Result can be got as a JSON file or XML file depending on your needs.here I will be getting the result as a JSON.
Create a new Android Project and add the android.permission.INTERNET to the manifest.
Now we have to send a HTTP Get request to the Google servers and receive a JSON file.
For this Purpose we will be importing the following classes.
First we have to have the URL to which the request is being sent.
Create a HttpClient from which the request must be sent.
Then we must construct the Http Request which is of GET method.
Then we must send the request to get a response.
After receiving the response we must extract the Entity from the HttpResponse. Then the JSONObject must be constructed from it. Since the JSONObject Constructor accepts only String we must convert the Contents of the HttpResponse into a String.
The procedure for converting Stream to String.
Now is the time for Parsing.
The JSON returned is like this.
So the Parser must be written to parse the JSON of above format.
A Toast message is shown to the User about the returned place names.