Find nearest resturant, coffee shop, and grocery store using google maps in android

我的梦境 提交于 2020-01-01 05:54:04

问题


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.


回答1:


This may help, dont know if it works for android..

http://code.google.com/apis/maps/documentation/places/




回答2:


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
 }



回答3:


There is no API for this in Android, sorry. There may be Web services you can use for this.




回答4:


May be this could help..

Intent intent =new Intent(Intent.ACTION_VIEW,Uri.parse("geo:0,0?q=Cafe")); startActivity(intent);



来源:https://stackoverflow.com/questions/4404439/find-nearest-resturant-coffee-shop-and-grocery-store-using-google-maps-in-andr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!