嗨,夥計們我正在使用谷歌地方API的應用程序。訪問谷歌Places API在android
我得到了我的應用程序的API密鑰,但問題是我得到ZERO_RESULTS
作爲服務器的響應。
這裏是我使用DefaultHttpClient
建立http連接的代碼。誰能告訴我有什麼問題? 請幫我卡在這裏。
public class Splash extends Activity{
private String keystring="";
//This is my request url
String requesturl="https://maps.googleapis.com/maps/api/place/search/json?" +
"location=17.739290150000002,83.3071201&radius=6000&" +
"types=hospital&sensor=false&key=";
private static byte[] key;
String signaturegot;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
/*
Here I am using default http client to establish
the connection for the request url
*/
HttpClient client=new DefaultHttpClient();
StringBuilder builder=new StringBuilder(requesturl);
builder.append(URLEncoder.encode(keystring));
HttpPost post=new HttpPost(requesturl);
try {
HttpResponse response=client.execute(post);
HttpEntity entity=response.getEntity();
if (entity != null) {
InputStream is = entity.getContent();
String val = StaticUtils.convertStreamToString(is);
Log.e("",val);
}
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
Here is the response from the server
{
"html_attributions" : [],
"results" : [],
"status" : "ZERO_RESULTS"
}
HIII所有我解決我的問題,我在url.It工作了me.Thanks請求給予,而不是類型的名稱.. – dharan