app running in browser but not running in phone

This forum contains topics that were moved from Get Satisfaction
Ram7585741
Posts: 0
Joined: Fri Jun 12, 2015 9:38 pm

app running in browser but not running in phone

Post 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();

Ram7585741
Posts: 0
Joined: Fri Jun 12, 2015 9:38 pm

app running in browser but not running in phone

Post by Ram7585741 »

here is the link to my app

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

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

app running in browser but not running in phone

Post by Alena Prykhodko »

Hello,

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

Ram7585741
Posts: 0
Joined: Fri Jun 12, 2015 9:38 pm

app running in browser but not running in phone

Post 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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

app running in browser but not running in phone

Post 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.

Ram7585741
Posts: 0
Joined: Fri Jun 12, 2015 9:38 pm

app running in browser but not running in phone

Post 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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

app running in browser but not running in phone

Post 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

Ram7585741
Posts: 0
Joined: Fri Jun 12, 2015 9:38 pm

app running in browser but not running in phone

Post by Ram7585741 »

Thanks a lot !

Post Reply