google-place-api返回null json

时间:2013-07-15 09:23:33

标签: android google-places-api

在我的应用程序中我想使用google place api来获取最近的地方,如atm,巴士站等... 但它返回null结果.. 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;

我有很多链接,但没有锦鲤帮milii ....

How can I search places with specific types using Google Places API?

finding both "Shopping_mall" and "food" within single URL for google places API

1 个答案:

答案 0 :(得分:0)

你使用密钥,即Android应用程序的密钥..而不是浏览器应用程序的密钥..使用dis ..它一定会运行... gud luck