Is there an App Close Event that can trigger some action?

I need to detect an App Close event (Android).
Is this possible? And if not can it be added?
I need to be able to Log the User Out of a Backendless DB session if they close the App without choosing the Logout option in the App.
Failing this I end up with lots of issues if they have too many current logins.
Setting a Session timeout in Backendless doesn’t seem to have the desired effect.
I can also increase the limit of concurrent logins allowed but they run out eventually too!
Solutions anyone?

if they close the app without logging out, you could log out your user. you could also store the token in an app variable. require a call using the token to allow the user to pass beyond the sign in screen. You might be able to create some kind of backend flow that can recognize when a user hasn’t had some in app action and invalidate their token that way.

what kind of issues are you running into with too many concurrent logins?

I use an app that always makes me log in if i’ve even had it in the background for a while. I think this is done by regularly polling your backend to keep the front “alive” so to speak. you could set a timer that if it ever hits 0 always redirects the user to the sign-in screen. you could reset that timer when the app is open by calling your backend.

1 Like

I use refresh tokens, if they have expired they are directed back to the log in screen

Edit: scroll down to the sign in with email and password, it returns some info that can be used to check

1 Like

Thanks guys.
I’m using Backendless as a DB and it also has a session based token for the user.
I did lower the session timeout but it didn’t seem to do anything.
So whilst testing the login / logout process I quickly ran into trouble.
It seems that the session timeout setting is finally being invoked and all is ok for now.

1 Like

Another way that is specific to Android is to use the back button pressed in the screen and use an alert or whatever process you want to close the active session.