简体   繁体   中英

Always logged in my android and ios app for mobile

I am developing ios and android application using java script. How to set my app always logged in state. For example,when i login in my app and then i just shutdown my device and then restart, then i click my app again,but it asks for log in. How to make my application always logged in as in Facebook app.Help me

Use Shared Preference for that. When user logged into your application store login status into sharedPreference and clear sharedPreference when user click on logged Out.

Check every time when user enter into application if user status from shared Preference is true then no need to login otherwise move to login page.

First create class in that class write all the functions set and get shared preference information or in javascript use localStorage to set and get values probably first time login to set userinfo using:

localStorage.setItem("name","vale");

after switch off you try to open your app, at the time use localStorage.getItem("name") based on that you can load your values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM