How to maintain a session in an Android Android application

I am new to developing phonegap and am currently developing an application that will run on Android, i-phone and Windows phone. But the problem with processing the session from the phonegap application is that I received a few messages here about the stack overflow, but this was only for the iphone using appDelegate.m that defines the cookie storage, and I also received several messages only for the Android storage session in the HttpClient object. encoded in java, but is there anything on the telephone side to handle the session, because then we can use the same code for all three devices (iphone, android, windows).

Perhaps I may sound kind of strange, but I really haven’t decided yet, because I can’t find any tips on how to maintain a session and how to use the same session for consecutive calls to the serveride script to get separate information about a particular session.

Is there any general way to achieve this that I can skip. Any help is much appreciated. Thanks in advance.

Respectfully,

Supriyo

+4
source share
2 answers

If I do not understand you, HTML5 localStorage is the way to go.

It is implemented in Phonegap, as described here: http://docs.phonegap.com/en/1.7.0/cordova_storage_storage.md.html#localStorage

+4
source

This works for me.

var CheckboxValue=$("#rememberme").is("checked"); if (CheckboxValue== true) { var username = $("#user").val(); var password = $("#pass").val(); window.localStorage.setItem("username", username); window.localStorage.setItem("password", password); } 
-4
source

Source: https://habr.com/ru/post/1415383/


All Articles