We've been working on a webapp for some time now which is designed to be accessed solely through our Android app. Obviously, the App itself is extremely lightweight -- mostly providing functionality for creating accounts and logging in, as well as make sure the webapp itself is only accessible through our Android app - BUT I digress...
The app is pretty dependent on PHP Session variables, which expire, and in the current testing environment, if your session expires you just get kicked out to the login screen anyway. But in production, the login screen will be on the Android app, completely independent of the WebView.
My idea right now is to have a Service run in the background which checks the timestamp we have in the database for a user's last activity, and if it's outside of a certain window, we close the webview. But if there was someway we could just exit the app after 15 minutes (or whatever) of inactivity--that would be preferable--or at least easier... I think...
Is there a way to do this -- set up an auto timeout exit function? Or maybe exit the app with the onPause function?
Close one app: Swipe up from the bottom, hold, then let go. Swipe up on the app. Close all apps: Swipe up from the bottom, hold, then let go. Swipe from left to right.
You can call System. exit(); to get out of all the acivities.
use 'System. exit(0);' when you really want to exit the app.
main. So although the call stack of an Android application start at ZygoteInit. main, the code executed in ZygoteInit. main begins after the call to runSelectLoop instead of the beginning of ZygoteInit.
My idea right now is to have a Service run in the background which checks the timestamp we have in the database for a user's last activity, and if it's outside of a certain window, we close the webview.
Why a Service
?
But if there was someway we could just exit the app after 15 minutes (or whatever) of inactivity--that would be preferable--or at least easier... I think...
You do not want to exit the app. You want to go back to the login screen.
Check the timeout status in onResume()
of the WebView
-hosting activity. If the activity is too old, call startActivity()
for your login screen, then call finish()
to close up the WebView
-hosting activity.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With