Dear all,
The index page of my app contains the login screen. When the app opens a number of functions are fired (e.g., check whether fingerprint authentication is available; ask for a PIN if not). When the app is not used for a couple of minutes, the app redirects to the login screen and a user has to log in again.
I am confused about how to fire the functions on the index page of my app, especially since the approach seems to differ for Android and iOS.
What I have after some trial and error.
For iOS, to get the functions fired, I succeed after
- I included all functions in
document.addEventListener("deviceready", function(){}
to load the functions at startup.; - To redirect the user to the login screen after several minutes of inactivity:
function goInactive() {app.views.main.router.back('/',{force: true, ignoreCache: true, reload: true});}
. - I had to include all functions again using
pageInit
in the Framework7 routes part of the app to fire them after the app redirects to the login screen.
For Android, to get the functions fired
- I had to include the functions in the
pageInit
part of the routing only, because thedocument.addEventListener
caused the functions to be fired twice. - To redirect the user to the login screen after several minutes of inactivity:
function goInactive() {app.views.main.router.back('/',{ignoreCache: true, reload: true});}
(i.e., withoutforce: true
).
Any hints on how to solve this issue (better understand what is going on), are appreciated.
Thanks.