Page 1 of 1

localStorage cleared on app restart

Posted: Wed May 06, 2015 10:09 am
by Shaun7189763

Hello,

I have set a localStorage value called 'token' that my application needs to get as soon as it is launched by the user.

The intended behaviour :

if 'token' is set = navigate directly form startScreen to another page.
if 'token' is undefined/null = stay on startScreen

The process works well with the buider's Test function (in the browser).

However in the Appery.io Tester, or on the exported App (apk) if the user closes the App (I mean totally with app swipe out of screen), 'token' is lost and becomes 'undefined'.

I thought localStorage is persistent and should not be cleared even when the application is closed. Am I doing something wrong ?

Thanks for your help.

Shaun


localStorage cleared on app restart

Posted: Wed May 06, 2015 6:15 pm
by Serhii Kulibaba

Hello,

localStorage store value even after exit from the app. Please check where in code you change it. Could you check are there any errors in console?


localStorage cleared on app restart

Posted: Wed May 06, 2015 7:13 pm
by Shaun7189763

Hello Sergiy,

There are no error in the console.

I have made a few changes and it is now working in the Apperyio tester but not with the proper apk.

When the user signs in successfully (on success) the app runs the following javascript :

localStorage.setItem('token', data.sessionToken);

I have the localstorage variable ready :

Image

When I exit the app, and open it again in the Apperyio Tester, I can see the localstorage value in a label component (local_data) I have created for this purpose :

I call the localstorage on page load :

Apperyio("local_data").text(localStorage.getItem('token'));

Image

However, with the proper app (apk), the localstorage is empty :

Image

What am I doing wrong ? Thanks in advance for your help.

Shaun


localStorage cleared on app restart

Posted: Thu May 07, 2015 12:21 pm
by Illya Stepanov

Hi Shaun -

Which Android version you're using for testing?

As you already noticed, it looks like there is a bug in Android 5.0 -- https://getsatisfaction.com/apperyio/...


localStorage cleared on app restart

Posted: Thu May 07, 2015 1:11 pm
by Shaun7189763

Hello Illya,

I'm testing on Android 5.0

Best regards


localStorage cleared on app restart

Posted: Fri May 08, 2015 1:38 pm
by Alena Prykhodko