Page 1 of 1

Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 3:08 pm
by Gavin Reynolds

I have a simple quiz (2 questions), where a right and wrong answer is displayed on each page in a radio button. A local variable is assigned to the options with either a value of 1 or 0 being assigned to the local variable.

Question 1
Correct: (Variable name: t1, Value: 1) or Wrong: (Variable name: t1, Value: 0)
Question 2
Correct: (Variable name: t2, Value: 1) or Wrong: (Variable name: t2, Value: 0)

I then have a results page where I have some JavaScript to calculate the sum of the local variables and display the results in a couple of labels.

var sumValue = parseInt(localStorage.getItem('t1')) + parseInt(localStorage.getItem('t2'));
Appery('result').text(''+sumValue);
if (sumValue == 0) {
Appery('message').text('0 correct answers');
}
if (sumValue == 1 ) {
Appery('message').text('1 Correct Answer');
}
if (sumValue == 2) {
Appery('message').text('2 Correct Answers');
}

In TEST mode, the quiz works perfectly - the correct local variables are being assigned and the correct total scores are being displayed on the results page.

However, when I export the APK file and load it on my phone (HTC One x Plus Android Version 4.2.2) the results page always shows 0 score despite selecting the correct questions.

Please can you help, as I used the same technique for another app about 6 months ago which worked fine - so it seems that something has changed.


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 3:16 pm
by Maryna Brodina

Hello! We'll check and let you know.


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 4:24 pm
by Gavin Reynolds

Thanks Marina - I am using the same instructions you originally provided to the following question which worked at the time:

https://getsatisfaction.com/apperyio/...


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 5:20 pm
by Maryna Brodina

Could you clarify do you use Mobile Radio Button component in your app?


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 6:52 pm
by Gavin Reynolds

Yes, Mobile Radio Buttons in a Mobile Radio Group. I used the same buttons in my old app.


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 7:01 pm
by Maryna Brodina

Thanks, seems to be a bug..


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 7:31 pm
by Gavin Reynolds

Is there any workaround?
What sort of timescale is there for getting bugs fixed?
Many thanks for your help.
Gavin


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 7:40 pm
by Maryna Brodina

Let me check...


Local Variables not working on phone but do on test

Posted: Mon Sep 02, 2013 8:01 pm
by Maryna Brodina

As a workaround try to use "Value Change" event. It works in browser and on device.