I am new to Codenameone , I am having strange issue in Codenameone's ConnectionRequest API while fetching response from https site in google pixel device in which anroid 10 is installed. fetching from https site is working fine.
However in the simulator it is fine and also with the other device that has android less than version 10.
what could be the solution for this OR am i doing somthing worng?
Here is my code and error i am getting in device
First Tried :
TextArea resultTextArea = new TextArea();
Button download = new Button("RUN");
download.addActionListener((e) -> {
ConnectionRequest cr = new ConnectionRequest(url, false);
SliderBridge.bindProgress(cr, progress);
NetworkManager.getInstance().addToQueueAndWait(cr);
if (cr.getResponseCode() == 200) {
String resultString = "";
try {
byte[] initialArray = cr.getResponseData();
resultString = new String(initialArray);
resultTextArea.setText(resultString);
} catch (Exception eee) {
resultString = "Error => " + resultString + eee.getMessage();
}
System.out.println(resultString);
}
});
Second Try: where url = http://192.168.2.100:8084/semms-webservice/rest/device/test/users
public void testURLConnectionResponse(String url) {
ConnectionRequest request = new ConnectionRequest();
request.setContentType("application/json");
request.setUrl(url);
request.setHttpMethod("GET");
TextArea resultTextArea = new TextArea();
String result = "";
result = "RESPONSE CODE :- " + request.getResponseCode() + " --- ";
Response<String> resultx = Rest.put(url).getAsString();
result += resultx.getResponseData();
resultTextArea.setText(result);
Form hi = new Form("Test Connection Response", new BoxLayout(BoxLayout.Y_AXIS));
Button mainFormButton = new Button("Back To Main Form");
mainFormButton.addActionListener((e) -> mainForm());
mainFormButton.setRippleEffect(true);
hi.add(mainFormButton);
hi.show();
// request will be handled asynchronously
NetworkManager.getInstance().addToQueue(request);
}
enter code here