Page 1 of 1

app running in browser but not running in phone

Posted: Sun Jun 21, 2015 7:05 pm
by Ram7585741

Hi,

I have developed a quiz app which is working fine when I am testing the app in pc browser.

But when i build apk and install on android 4.2.2 device, it does not load at all.

I had coded for radio button click event initially. After reading some posts here, I modified them to 'value change'.

I have below the code which is executed on page load event.

jQuery.getJSON("files/resources/data/mf.json", function(result){
localStorage.setItem("data",JSON.stringify(result));
var sam = new Array(result.length);
localStorage.setItem("answers",JSON.stringify(sam));
});
var data = localStorage.getItem("data");
var mydata = JSON.parse(data);
count = 0;
localStorage.setItem("count",count);
Apperyio('question').val(mydata[count].question);
Apperyio("choice1").find(".ui-btn").text(mydata[count].choice1);
Apperyio("choice2").find(".ui-btn").text(mydata[count].choice2);
Apperyio("choice3").find(".ui-btn").text(mydata[count].choice3);
Apperyio("choice4").find(".ui-btn").text(mydata[count].choice4);
Apperyio("submitexam").hide();
Apperyio("prevButton").hide();


app running in browser but not running in phone

Posted: Sun Jun 21, 2015 7:20 pm
by Ram7585741

here is the link to my app

http://mocktest.app.appery.io/


app running in browser but not running in phone

Posted: Sun Jun 21, 2015 8:45 pm
by Alena Prykhodko

Hello,

Please try to debug it remotely https://devcenter.appery.io/documenta...
Are there errors?


app running in browser but not running in phone

Posted: Sun Jun 21, 2015 9:47 pm
by Ram7585741

Uncaught TypeError: Cannot read property '0' of null - I get this error.

After clearing browser cache, when i test the app - it keeps loading and getJson request returns NULL.

If I launch the test again , then immediately the page loads and I get correct values through getjson request.


app running in browser but not running in phone

Posted: Tue Jun 23, 2015 3:31 am
by Yurii Orishchuk

Hello,

You need to use result only in success event handler. Currently you use it outside. This is two different code flows.

Here is a code to try:

pre

jQuery.getJSON("files/resources/data/mf.json", function(result){
localStorage.setItem("data",JSON.stringify(result));
var sam = new Array(result.length);
localStorage.setItem("answers",JSON.stringify(sam));

var data = localStorage.getItem("data");
var mydata = JSON.parse(data);
count = 0;
localStorage.setItem("count",count);
Apperyio('question').val(mydata[count].question);
Apperyio("choice1").find(".ui-btn").text(mydata[count].choice1);
Apperyio("choice2").find(".ui-btn").text(mydata[count].choice2);
Apperyio("choice3").find(".ui-btn").text(mydata[count].choice3);
Apperyio("choice4").find(".ui-btn").text(mydata[count].choice4);
Apperyio("submitexam").hide();
Apperyio("prevButton").hide();

});

/pre

Regards.


app running in browser but not running in phone

Posted: Tue Jun 23, 2015 5:11 pm
by Ram7585741

Hi,

Thanks a lot ! it works.

By the way, is there any other alternate method to reduce the loading the time of getjson request.

I am just trying to load a file with 10 records and it takes a long time.

Is there any statistic linking the json file size and load time ? ( like - a 1 mb file will take 30 secs to load....etc)

Regards

Ram


app running in browser but not running in phone

Posted: Tue Jun 23, 2015 9:56 pm
by Yurii Orishchuk

Hi Modelexam,

Yes, you can add create new JS asset and put all JS code here. It will be available at once you started the app. And on the mobile device it will not use network to get this file.

Details how to create new JS asset: http://prntscr.com/7kjaix/direct


app running in browser but not running in phone

Posted: Mon Jun 29, 2015 2:27 pm
by Ram7585741

Thanks a lot !