triggers - Android app to check for login only one time a day -


i need develop android app have login activity force user must login 1 time day , after login app not going show login activity.it want skip login if user done login successful.on next day app must want show login page.can use shared preferences method or database here? how can implement this!

you can use calendar instance on splash or main activity , can save in shared preference save date below--

//this reference code  sharedpreference shared=getsharedpreferences(preference.key_pref,mode_private);     editor  edit=shared.edit();         if(!shared.getboolean(preference.key_first_time, false)){             edit.putboolean(preference.key_first_time,true );             calendar first=calendar.getinstance();             edit.putlong(preference.key_first_date, first.get(calendar.date);); 

1>this can stored last launching date

2>get current date every time app starts , check if current date = last launching date

3>if same no need show login else show login , save current date last launching date.

that should it.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -