Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello guys,
I want to know how to find nearest restaurants in my location (using google map), and displays them in a ListBox in my windows phone 7 application, I have researched a lot but I don't find any tutorial works with C#
Any help please?
Posted

1 solution

Hello,

Look at this article in codeproject that will show you how to use the Google Places Api:
Event Finder - Google Places Event App[^]

If you need more references about the place APi look on the developers google site, here:
https://developers.google.com/places/[^]

good luck ;)

Valery.
 
Share this answer
 
Comments
Taleb Atoui 22-Apr-13 1:12am    
Hello Valery,
Thank you for your solution, I develops a windows phone 7 application that don't accept HTML tags :(
So, can you give me more helps please?
I need a tutorial how to displays the nearby places which are for a specific type (Restaurants, Hotels...) in a ListBox without using HTML tags or Javascript.. only C#.
Thanks in advance :)
Taleb
Valery Possoz 22-Apr-13 8:23am    
Hello.

use a httpwebrequest:

HttpWebRequest webRequest = WebRequest.Create(@"https://maps.googleapis.com/maps/api/place/search/json?location=52.00,1.1957362&radius=7500&types=restaurant&sensor=false&key=yourkey") as HttpWebRequest;
webRequest.Timeout = 20000;
webRequest.Method = "GET";
webRequest.BeginGetResponse(new AsyncCallback(RequestCompleted), webRequest);

and in the call back parse the response:

private static void RequestCompleted(IAsyncResult result)
{
HttpWebRequest request = (HttpWebRequest)result.AsyncState;
HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(result);
string response = string.Empty;
using (Stream stream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(stream);
response = reader.ReadToEnd();
}
}

The response string will have something like:
"results" :
...
"geometry" : {
"location" : {
"lat" : 51.8664050,
"lng" : 1.2132110
}
...
"name" : "King of spices",

write a class to parse the response and load in the listbox the info you like.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900