提问者:小点点

google-place-api返回空json


在我的应用程序中,我想使用谷歌的地方api,以获得最近的地方,如自动取款机,公共汽车站等。。。但返回空结果。。url为

https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=28.568315675,77.33492885&radius=5000&types=atm&sensor=false&key=aizasyaryw3r30sfqcsdb3wqr_eeiz_davyuilq

代码为::

    String data = "";
    InputStream iStream = null;
    HttpURLConnection urlConnection = null;
    try{
            URL url = new URL(strUrl);                



            urlConnection = (HttpURLConnection) url.openConnection();                


            urlConnection.connect();                


            iStream = urlConnection.getInputStream();

            BufferedReader br = new BufferedReader(new InputStreamReader(iStream));

            StringBuffer sb  = new StringBuffer();

            String line = "";
            while( ( line = br.readLine())  != null){
                    sb.append(line);
            }

            data = sb.toString();

            br.close();

    }catch(Exception e){
            Log.d("Exception while downloading url", e.toString());
    }finally{
            iStream.close();
            urlConnection.disconnect();
    }
    return data;

我看了很多链接,但是没有锦鲤帮助我。。。。

如何使用Google places API搜索特定类型的地方?

在google places API的单个URL中同时查找“shopping_mall”和“food”


共1个答案

匿名用户

你在使用键,即android应用程序的键。而不是浏览器应用程序的键。使用DIS.。它肯定会运行。。。真走运