Hi,
I have a created a mobile application. On clicking on logout it is taking to login page but if I click on back button it is going back to same page. I'm using custom API for login and signup for the mobile application. How do I implement sessions for this app?
Regards,
Vaishnavi
Hi Vaishnavi,
Can you try the solution that I posted above?
It will disable your back button for Android devices.
Kind regards,
Rui Barradas
Hello Vaishnavi,
There is no concept of Session in Mobile. Mobile apps run on the device (client-side) while Session variables are stored in the server. So the notion of Session variables in the context of mobile doesn't exist.
Everytime the device calls the server, it is a different Web Request. So all of the session variables stored before will be lost.
This is actually one of the major differences between Mobile / Reactive Web applications and Traditional Web applications. Sessions apply only for Traditional Web applications.
Rui Barradas wrote:
Hi Rui,
Okay but then whenever clicked on logout button and again back it goes back. Any solution for it to not go back?
Hello again Vaishnavi,
Are you talking about back button on Android devices, right?
Hi Riu,
Yes. When we click back button on android device.
If you want, you can disable the Back button of your application.
In order to do this, you should use the OnApplicationReady and OnApplicationResume events:
You just need to add a JavaScript node in each one of those events, with this line:
document.addEventListener("backbutton", function(){}, false);
Basically, this will disable your Back button.
Let me know if it worked for you.
It workeddd!! Thankyou so muchhhh:):)
Those are great news :)
You're welcome! I'm glad that you managed to solve it!