Login and Session Management for Appgyver Supersonic

991 views Asked by At

I just started using Appgyver's Platform: Supersonic and Composer. I have set my login screen and what it does is upon confirmation that the user is indeed a user, it redirects it to another page. I used supersonic.ui.initialView.dismiss() to achieve that.

Now I need to store data locally so that I can continuously access it for extending functionality. Any idea, reference links or so on?

1

There are 1 answers

4
area28 On BEST ANSWER

Use localStorage on the phone. You can get/set/delete localStorage items easily. Here is a doc on Appgyver.

Here is an example of storing latitude and longitude:

var coords = { 
    lat : 'some value',
    lon : 'some other value'
}
localStorage.setItem('NameOfApp_coords', JSON.stringify(coords)); 

And getting the item from localStorage:

var coords = localStorage.getItem('NameOfApp_coords');
if(typeof coords !== undefined) {
    parsedCoords = JSON.parse(coords);
}

You can remove items as well:

localStorage.removeItem('NameOfApp_coords');