codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Home Page:https://www.codenameone.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ios 15.5 issue requesting connection with mobile connection instead of wifi

DurankGts opened this issue · comments

commented

I have found a problem trying to connect to google api using mobile connection instead wifi. in ios: 15.5 . using ios 16.4.1 don't fail. I check in the real device iphone 13 pro max ios 15.5.

with wi-fi
image

with mobile data
image

test case.
just execute the method ssueRequestingDataIos() in you star() app test case.

//----------------------------------------------------------
//ISSUE:21-04-23 11:21AM
//----------------------------------------------------------
private void issueRequestingDataIos() {

         Form hi = new Form("issueRequestingInIos15.5", new BorderLayout());
         hi.setName("formRequestPermission");
         hi.setUIID("MyForm");
         hi.setSafeArea(true);
         hi.setFormBottomPaddingEditingMode(true);
         hi.setScrollableY(false);
         
        Button rp = new Button("Request","ecs_btnSos2");
        rp.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent evt) {
                 requestDataFromInternet();
             }
         });
        hi.add(BorderLayout.CENTER, FlowLayout.encloseCenterMiddle(rp));
        hi.show();
         
    }
    //----------------------------------------------------------
    public static void requestDataFromInternet() {

        try {
            ConnectionRequest req = new ConnectionRequest() {
                @Override
                protected void handleErrorResponseCode(int code, String message) {
                    if (code == 400) {
                        //Do what you want here
                        
                    } 
                    Dialog.show("Error: " + code, message+"\n"+" Do you want to continue", "YES","NOT");
                }
                @Override
                protected void buildRequestBody(OutputStream os) throws IOException {
                    super.buildRequestBody(os); //To change body of generated methods, choose Tools | Templates.
                }
                @Override
                protected void readResponse(InputStream input) throws IOException {
                    //super.readResponse(input); //To change body of generated methods, choose Tools | Templates.
                    
                    try {
                        String dataFromServer = Util.readToString(input, "UTF-8");
                        
                        JSONObject data = new JSONObject(dataFromServer);
                        System.out.println("response:" + data.toString());
                        
                        Dialog.show("Data", data.toString(), "CONTINUE", "NOT");
                    } catch (IOException e) {
                        System.out.println("Error1:" + e.toString());
                    } catch (JSONException e) {
                        System.out.println("Error2:" + e.toString());
                    }
                }
            };
            req.setUrl("https://maps.googleapis.com/maps/api/geocode/json");
            req.setPost(false);
            req.addArgument("key", "use your google key please to test");
            req.addArgument("latlng", "18.47940305,-69.93038722");
            req.addArgument("language", "es");
            req.setFailSilently(false);
            req.setReadResponseForErrors(true);
            req.addResponseListener(new ActionListener<NetworkEvent>() {
                @Override
                public void actionPerformed(NetworkEvent evt) {
                   System.out.println("Error25:" + evt.getMessage());
                }
            });
            NetworkManager.getInstance().addToQueueAndWait(req);
        } catch (Exception e) {
            System.out.println("Error" + e.toString());
        }
    //----------------------------------------------------------
commented

please check you support mail with more details

commented

any solution about this issue?

Was this resolved?

commented

not, the problem it continue failing in ios 15.5 compiled yesterday at 18:22 hour in dominican republic