Привет, ребята Я работаю над приложением, которое использует API google places.Расширение API Google Places в 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