skip to Main Content

I am just start working in INTEL XDK after almost one year.I have created 20-21 android apps.Now I had downloaded aIntel xdk new version about 3 months ago.and now I have downloaded the latest version of intel xdk.

I have created an apk which was based on ajax call,The apk was working fine in emulator,testing as well as debugging through device, but while I have created an apk it is not working in my device.

For that I have tried so many sollutions , suggestions which are given on web,added xhr.js etc..but it was no working properly.

But When I have created again with old XDK perhapes it was verson 1621 or older than it, it is working properly.

So with the latest version of XDK I am facing issue with ajax but not in old version.What should be the problem with latest version of XDK?
My current version is 1912

Here is my code STRUCTURE
enter image description here

index.html

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
        <meta charset="UTF-8">
        <title>Blank App Designer Cordova Web App Project Template</title>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8">
        <style>
                @-ms-viewport { width: 100vw ; min-zoom: 100% ; zoom: 100% ; }          @viewport { width: 100vw ; min-zoom: 100% zoom: 100% ; }
                @-ms-viewport { user-zoom: fixed ; min-zoom: 100% ; }                   @viewport { user-zoom: fixed ; min-zoom: 100% ; }
                /*@-ms-viewport { user-zoom: zoom ; min-zoom: 100% ; max-zoom: 200% ; }   @viewport { user-zoom: zoom ; min-zoom: 100% ; max-zoom: 200% ; }*/
        </style>

        <link rel="stylesheet" href="css/app.css">
        <link rel="stylesheet" type="text/css" href="css/index_main.less.css" class="main-less">
        <script src="jquery/jquery.js"></script>
        <script src="cordova.js" id="xdkJScordova_"></script>
        <script src="js/app.js"></script>
        <!-- for your event code, see README and file comments for details -->
        <script src="js/init-app.js"></script>
        <!-- for your init code, see README and file comments for details -->
        <script src="xdk/init-dev.js"></script>
        <script src='xhr.js'></script>
        <!-- normalizes device and document ready events, see file for details -->
    </head>

    <body>
        <div class="upage vertical-col" id="mainpage">
            <div class="grid grid-pad urow uib_row_1 row-height-1" data-uib="layout/row" data-ver="0">
                <div class="col uib_col_1 col-0_12-12" data-uib="layout/col" data-ver="0">
                    <div class="widget-container content-area vertical-col">
                        <span class="uib_shim"></span>
                    </div>
                </div>
                <span class="uib_shim"></span>
            </div>

            <div class="grid grid-pad urow uib_row_3 row-height-3" data-uib="layout/row" data-ver="0">
                <div class="col uib_col_3 col-0_12-12" data-uib="layout/col" data-ver="0">
                    <div class="widget-container content-area vertical-col">

                        <div class="table-thing widget uib_w_1 d-margins" data-uib="twitter%20bootstrap/input" data-ver="1">
                            <label class="narrow-control label-top-left">User Name</label>
                            <input class="wide-control form-control default" type="text" placeholder="User Name">
                        </div><span class="uib_shim"></span>
                        <div class="table-thing widget uib_w_1 d-margins" data-uib="twitter%20bootstrap/input" data-ver="1">
                            <label class="narrow-control label-top-left">Password</label>
                            <input class="wide-control form-control default" type="text" placeholder="Password">
                        </div>
                        <button class="btn widget uib_w_2 d-margins btn-default" data-uib="twitter%20bootstrap/button" data-ver="1" id="login"><i class="glyphicon glyphicon-ok button-icon-left" data-position="left"></i>Login</button><span class="uib_shim"></span>
                    </div>
                </div>
                <span class="uib_shim"></span>
            </div>
        </div>
        <script>
        $("#login").click(function(){
         $.ajax({
        type:'GET',
        url:'http://time.jsontest.com/',
        error: function(response, d, a){
            alert(response + d + a) ;  
        },
        success: function (response){
            alert(JSON.stringify(response));        
        }
    });
        });
        </script>
    </body>

</html>

2

Answers


  1. There is a known ajax issue with apk built with latest Intel XDK on Android > 4.4, this is due to the version of Cordova CLI 4.1.2.

    In the Intel XDK -> project settings -> build settings for Android, change the Cordova CLI version to 3.5 and ajax should work again. We are working on a fix when using latest CLI

    Login or Signup to reply.
  2. @Hardik, There are some changes in the Cordova 4.1.2 security model and hence you have to use proper settings in the Build Settings of Intel XDK. Please read this article to find out how you should set the build settings before you build your app.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search