Reputation: 291
I am working in android sdk and using google maps api. I wanted to know if there is any way to find the nearest resturant or coffee shop or a grocery store from current location of the user.
There are many apps available for this purpose but i want to code my own application for learning purpose.
Upvotes: 4
Views: 35788
Reputation: 1
May be this could help..
Intent intent =new Intent(Intent.ACTION_VIEW,Uri.parse("geo:0,0?q=Cafe")); startActivity(intent);
Upvotes: 0
Reputation: 3930
I've had the same issue making a Navigation program for Android.
I ended up using Yahoo! Local Search web service, it worked pretty well.
You should understand how web services work, but basically you make an HTTP GET request with the parameters, such as Location, Query (restaurant, coffee, etc) and other parameters, and you get a response as XML or JSON (your choice).
What you do with the results is up to you
Additions:
Yahoo Local Search results are default to XML.
This is an example of how to make the request in Android:
public void doWebRequest()
{
try {
HttpClient client = new DefaultHttpClient();
String url = "http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=pizza&zip=94306&results=2";
HttpGet request = new HttpGet(url);
HttpResponse response = client.execute(request);
BufferedInputStream bis = new BufferedInputStream(response.getEntity().getContent());
SAXReader reader = new SAXReader();
handleResponse(reader.read(bis));
} catch (Exception e) {
System.err.println(e);
}
}
private void handleResponse(Document doc) {
// doc is the XML response
// process the results here
}
Upvotes: 1
Reputation: 6004
This may help, dont know if it works for android..
http://code.google.com/apis/maps/documentation/places/
Upvotes: 2
Reputation: 1007339
There is no API for this in Android, sorry. There may be Web services you can use for this.
Upvotes: 0