119
Views
8
Comments
Solved
How to give sessions in a mobile application?

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

2020-05-07 18-53-00
Rui Barradas
 
MVP
Solution

Hi Vaishnavi,


Can you try the solution that I posted above?

It will disable your back button for Android devices.


Kind regards,

Rui Barradas

2020-05-07 18-53-00
Rui Barradas
 
MVP

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.


Kind regards,

Rui Barradas

UserImage.jpg
Vaishnavi Choppalli

Rui Barradas wrote:

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.


Kind regards,

Rui Barradas

 

 Hi Rui,

            Okay but then whenever clicked on logout button and again back it goes back. Any solution for it to not go back?

Regards,

Vaishnavi

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hello again Vaishnavi,

Are you talking about back button on Android devices, right?


Kind regards,

Rui Barradas

UserImage.jpg
Vaishnavi Choppalli

Rui Barradas wrote:

Hello again Vaishnavi,

Are you talking about back button on Android devices, right?


Kind regards,

Rui Barradas

 Hi Riu,

           Yes. When we click back button on android device.


Regards,

Vaishnavi

 

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hi Vaishnavi,

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.


Kind regards,

Rui Barradas

2020-05-07 18-53-00
Rui Barradas
 
MVP
Solution

Hi Vaishnavi,


Can you try the solution that I posted above?

It will disable your back button for Android devices.


Kind regards,

Rui Barradas

UserImage.jpg
Vaishnavi Choppalli

Rui Barradas wrote:

Hi Vaishnavi,


Can you try the solution that I posted above?

It will disable your back button for Android devices.


Kind regards,

Rui Barradas

 Hi Rui,

           It workeddd!! Thankyou so muchhhh:):)

Regards,

Vaishnavi

 

2020-05-07 18-53-00
Rui Barradas
 
MVP

Hello Vaishnavi,

Those are great news :)

You're welcome! I'm glad that you managed to solve it!


Kind regards,

Rui Barradas

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.