Software Archive
Read-only legacy content

URGENT HELP NEEDED !! Suddenly stopped working ?

phil_J_
New Contributor I
583 Views

UPDATED: See my comment of 15th Feb below..!!!

Ive got an App that takes photos and uploads to server, then an option that pulls them back and displays in a list. Works fine in emulator and was working fine on the App preview on iPhone, but suddenly the App preview isn't working. The App itself is ok, takes photo but upload isn't working at all.

Has anything changed recently that could cause this. I've even deleted and reinstalled the App but same thing, Emilator fine (so I know backend is ok), Preview not.

Phil

 

 

 

0 Kudos
13 Replies
PaulF_IntelCorp
Employee
583 Views

Are you still experiencing this issue?

0 Kudos
phil_J_
New Contributor I
583 Views

Some very Odd things going on for me.

Just went into Emulator and when I select the Debug Console - the Emulator screen just goes blank!! Close debug and the full screen reappears?? So hard to debug...

I'm on v2893 - recently updated.

As for the other query above - my code works fine in the XDK emulator and uploads to my server then retrieves for me;

However when I Push to test server and test on App Preview - it doesn't upload, but DOES bring back the pics that I uploaded from the emulator.

The code that does the upload is as follows;

And it does jump to page #uib_page_2 after a few seconds...so appears to have worked

<script>
            function upload(form) {
                        var d=new Date();
                        var n = d.toLocaleString(d);
                        var elem = document.getElementById("PostedDate");
                        elem.value = n;
                        var uid = device.uuid;
                        var elem = document.getElementById("Uuid");
                        elem.value = uid;
                                       
                        getLocation();
                    
                        $form = $('#upload-form');
             
                 //
                 
                        fd = new FormData($form[0]);
                        $.ajax(
                            'http://xxxxx.uk/VBpostpost.php',
                            {
                            type: 'post',
                            processData: false,
                            contentType: false,
                            data: fd,
                            dataType: "json",
                            success: function(data) {    
                                        activate_subpage("#uib_page_2"); 
                            },
                            error: function(XMLHttpRequest, textStatus, errorThrown) {
                               console.log ("Err");
                               console.log(XMLHttpRequest, textStatus, errorThrown);
                      
                            }
                        });
                        return false;
                    }
        </script>

 

 

0 Kudos
Anusha_M_Intel1
Employee
583 Views

Hi Phil. There was an app preview update three weeks ago. But it was mostly bug fixes and I doubt it could have affected your app. Has there been any changes to your source code since then?

0 Kudos
phil_J_
New Contributor I
583 Views

 

Hi, no nothing has changed. How do I get the update, could that help?

How about the emulator going blank screen when I load the em debug window? I use this all the time and only started happening since last update 

0 Kudos
phil_J_
New Contributor I
583 Views

Update: My partner needs this App to do a Demo to a potential investor this week - so any help much appreciated.

I have totally re installed the XDK and the App Preview (on iPhone) and still getting odd results. (The emulator debug problem has disappeared after re install).

I am simply trying to upload a picture - PHP Server - writes to database; then a refresh button in App to pull back down.

In the Emulator - it all works like a dream - but when pushing app and testing on app Preview - doesn't upload and doesn't bring back..

The code for upload and download is below:

I have since taken out the bits of code in the Upload that get Date, Uuid, and location - and it appears to upload now  - but still doesn't bring back...

ANY HELP AT ALL much appreciated as we are up against time deadlines.

 

// Refresh and bring data back      
  <script type="text/javascript">
            function loadlistData()
             {        
                 var xmlhttp = new XHRObject();
                 xmlhttp.onreadystatechange=function()
                    {       
                     if (xmlhttp.readyState==4 && xmlhttp.status==200)
                        {    
                          
                        var arr = JSON.parse(xmlhttp.responseText);                                        
                        var i = 0;
                        var out = "<ul class='list widget uib_w_24 d-margins' data-uib='app_framework/listview' data-ver='3'>";
                   
                        for(i = 0; i < arr.length; i++) {
                            out += "<li class='widget uib_w_25' data-uib='app_framework/listitem' data-ver='0' id='SDListItem'>";
                            out += "<a>";
                            out += "<img src= " + arr.Graphic + " width='100', height='100' />";
                            out += "<p><strong>" + arr.VehicleReg + "</strong> <br/>";
                         //   out += "<h3>" + arr.Category +"</h3>";
                        //    out += "<h3>" + arr.Date +"</h3>";
                        //    out += "<p>" + arr.Details + "<br/>";
                            out += "<p>" + arr.IPTCData + "<br/>";
                            out += "</a>";
                            out += "</li>";
                                           
                        }
                       out += "</ul>";
                                         
             
                     document.getElementById("id01").innerHTML = out;                     
                    }
                 }
                   xmlhttp.open("GET","http://xxxxx.co.uk/VBGetPosts.php?posts=all", false);
                 xmlhttp.send();    
             }
        </script>

//Get current Location

        <script>
            var getLocation = function() 
            {
                var suc = function(p){
                if (p.coords.latitude != undefined)
                {
                    currentLatitude = p.coords.latitude;
                    currentLongitude = p.coords.longitude;
                    var elem = document.getElementById("CurLat");
                    elem.value = currentLatitude;
                    var elem = document.getElementById("CurLon");
                    elem.value = currentLongitude;
                }
            };
            var fail = function(){ 
                var elem = document.getElementById("CurLat");
                elem.value = 999;
                var elem = document.getElementById("CurLon");
                elem.value = 999;
            };
    
            navigator.geolocation.getCurrentPosition(suc,fail);
            }
        </script>

//Upload photo
        <script>
            function upload(form) {
                        var d=new Date();
                        var n = d.toLocaleString(d);
                        var elem = document.getElementById("PostedDate");
                        elem.value = n;
                        var uid = device.uuid;
                        var elem = document.getElementById("Uuid");
                        elem.value = uid;
                                       
                       getLocation();
                    
                        $form = $('#upload-form');
             
                 //
                 
                        fd = new FormData($form[0]);
                        $.ajax(
   
                         'http://xxxxx.co.uk/VBpostpost.php',
                            {
                            type: 'post',
                            processData: false,
                            contentType: false,
                            data: fd,
                            dataType: "json",
                            success: function(data) {
                                activate_subpage("#uib_page_2"); 
                               
                            },
                            error: function(XMLHttpRequest, textStatus, errorThrown) {
                               console.log ("Err");
                               console.log(XMLHttpRequest, textStatus, errorThrown);
                                //alert( "ERROR" );
                                //alert( textStatus );
                                //alert( errorThrown );   
                            }
                        });
                        return false;
                    }
        </script>

 

 

 

0 Kudos
Rodrigo_M_1
New Contributor II
583 Views

Hi phil J., may you should try build the application and install it in the phone once the emulator is working, and on app preview may have some problem to execute some tasks just like if you use 3rd party plugin is not going to work on both (emulator and app preview) !

Try build the app and install it just in case!

Good look!

0 Kudos
PaulF_IntelCorp
Employee
583 Views

Are you filling out the whitelist in the build settings?

  • The Emulate tab and Debug tab do not simulate the whitelist feature, that only shows up in a built app. It may be that your attempts to use the build app are being affected by the whitelist.
  • Make sure you are building for Crosswalk, not Android.
  • You CAN debug a built app using this technique > https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview#RemoteChromeDevTools < which will give you the most accurate debug environment because you'll be debugging a built app on a real device. In CDT you can watch and inspect the network activities of your app.
  • Move your code to js files, do not embed it in the index.html file, it will be MUCH easier to debug if it is contained in a separate JS file that you load.
  • Make sure you are waiting for the deviceready event (or the app.Ready event if you are using the xdk/init-dev.js).
  • Once you move your code to a JS file, use the jshint feature in the editor (make sure to add the various hint/lint tools). There are many bugs that can be fixed by following the hint/lint rules.
0 Kudos
phil_J_
New Contributor I
583 Views

Hi Paul thanks for your input.

I've not actually built the APP just using the App Preview - and like I said it did work a week or 2 ago and now doesn't.

0 Kudos
John_H_Intel2
Employee
583 Views

What platform are you testing App Preview with? I ask because we have not updated App Preview in the stores for iOS since December and Android since the first week of January. Windows App Preview was updated 2/8.

0 Kudos
phil_J_
New Contributor I
583 Views

I've tried it on iOs and Android

Wondering if something broke on last XDK update?

Does my code look ok for upload and download?

Like I said - works in EMulator just not on device

 

 

 

0 Kudos
PaulF_IntelCorp
Employee
583 Views

Phil -- please try using the Debug tab or a built app, App Preview is a quick preview tool, it is not a good debugging tool.

0 Kudos
phil_J_
New Contributor I
583 Views

Ok - am I right in saying the TEST tab is for using App Preview (with the embedded line of code) and debug over wireless....?

The DEBUG Tab - is this for after sending a built crosswalk app down?

I'm trying to shortcut things a bit because my partner is over in the USA and looking to demo something on Friday - we thought we had it working ** (which it was) but now panicing a bit....

 

** Have added the debug line into Head of html; pushed the code; using the TEST Tab with WIFI - and Local App on Preview - can run it - but not getting any debug info?

**

 

 

0 Kudos
PaulF_IntelCorp
Employee
583 Views

Yes, the Test tab uses App Preview and you can use weinre with it, but the Debug tab will build you a custom debug module and allow you to use Chrome DevTools, for a much better debug environment (weinre is very restricted). Remove any weinre script before you use the Debug tab or the Emulate tab, it will interfere with your results.

See this doc page > https://software.intel.com/en-us/xdk/docs/intel-xdk-debug-and-test-overview, in particular:

will provide the most accurate debug environments (using an Android device).

  • Always build with Crosswalk on Android!
  • Use CLI 5.1.1 for all platforms!
0 Kudos
Reply