Hi,
I want mobile app to be closed if the user doesn't use it for some time(eg:20mits) and lets the app open as it is or forget to close. Is there any way I can force to close the Mobile app? like session timeout in Web application.
Thanks,
Karnan
Hi Karam,
Yes I think it is possible.
Create On the Logics tab on Client Actions the server event OnApplicationReady:
In the javascript flow element enter the following code:
5000 is a timeout of 5 seconds, adjust it according to your needs.
Good Luck,
Daniel
Thank you!!
Hi, is the navigator.app.exitApp() a built-in?
Do I need to install Cordova plugin?
Thanks.
It is part of Cordova framework that is used by OutSystems to create IOS and android apps, no need to install a plugin.
Thanks Daniël.
It was a very useful info.
Your welcome Harlin,
if my answer was a solution to your question could you mark it as a solution?
Regards,
Danfiel
Unfortunately I'm not the topic starter, so I cannot mark it as solution.
Ha my mistake.
Hi Daniel,
Couldn't make it to work on ipad.
Pls advise.
Rom
Hi Romuel,
It does work on my android phone, unfortunately i don't have an ipad to test on it.
Does it work on other devices? Iphone, Android?
It only works for Android. We tried it on ipad and iphone but it does not close the app.
Romuel
That's a bummer. I'll see if I can find a solution for IOS.
According to:
https://developer.apple.com/library/content/qa/qa1561/_index.html
There's no way to exit app programmatically in IOS.
Thanks, Harlin.
In that case, is there a way to redirect to another screen inside an OnApplicationReady/OnApplicationResume system event if closing the app is not an option for iOS devices.
Yes, there's an action you can use to detect if it's under IOS or Android.
In the WebPatterns you can use the action CurrentOS to identify the device OS.
Hi Harlin,
Thanks for your reply. But I was hoping there is another way to redirect to another screen inside OnApplicationReady or OnApplicationResume. This way, I won't have to close the app and just redirect to another screen instead.
What exactly is your use-case? Where would you want to redirect when the App first launches?
If it's a matter of forcing login on reopen, then you just need to setup session authentication. If not, consider this approach (I haven't thoroughly tested it, just quickly whipped something up):
(find a sample app attached)
Thanks, Jorge for this! Haven't thought of using a web block. Will try this out later.
My use case is to redirect the user to a screen (most probably the login page) if he decides to cancel the Fingerprint authentication. On android I am able to exit the app so when user tries to resume the app, the fingerprint authentication kicks in again. In iOS, closing the app is not acceptable although still possible so I was thinking of redirection strategy. Perhaps you could suggest another solution.
Hi Jorge,
The solution you suggested works!
Thanks!