B4X:
public String doGet(String url, String deviceId, String tokena) {
HttpGet get =null;
get = new HttpGet(url+"/"+deviceId);
get.addHeader("app_key", "f8fc0c83-eebd-4926-9ac7-2584831ce303");
get.addHeader("Authorization","Bearer" + " " + tokena);
get.setHeader("Content-Type", "Content-Type:application/json; charset=UTF-8");
try {
HttpResponse response = this.execute(get);
StatusLine statusLine = response.getStatusLine();
int code = statusLine.getStatusCode();
if(code==HttpURLConnection.HTTP_OK){
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = br.readLine();
while(line != null){
System.out.println(line);
line=br.readLine();
}
}
} catch (ClientProtocolException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return line;
}
Error:
Compiling generated Java code. Error
javac 1.8.0_112
src\b4j\example\main.java:218: Error: 找不到符号
HttpResponse response = this.execute(get);
^
符号: 方法 execute(HttpGet)
1 Error