cancel
Showing results for 
Search instead for 
Did you mean: 

Session timeout for MCF application

0 Kudos

Hi guys,

I am facing one issue for the session timeout. I want to control the session time to if i switched the tab or minimize the browser. I have written a code to calculate the session but if i switched the tab, the timeout call back function is not working after 2-3 hit and then again start working if i came back to tab.

handleSession:function()

{

var sessionExpiry = parseInt(10);

var oThis = this;

var currentTime = new Date();

var lastAccess = this.oApp.getDataProvider().SERVICE.getSessionTime();

var diffMs = (currentTime - lastAccess); // Milliseconds

var diffMins= Math.floor((diffMs/1000)/60);

if (!that.oSessionDialog)

{

try

{

that.oSessionDialog = sap.ui.xmlfragment("sap.umc.mobile.private.app.view.SessionOut", this);

that.getView().addDependent(oThis.oSessionDialog);

}

catch(ex)

{

return;

}

}

if (diffMins >= sessionExpiry)

{

if(that.oSessionDialog.isOpen() == false)

{

that.oSessionDialog.open();

oThis.nTimer = 90;

}

oThis.setInterval(1);

}

else

{

setTimeout(function()

{

oThis.handleSession()

},100);

}

},

This is the code i have used for as of now. setTimeout will work properly if i stayed on the same tab, but if i switched or minimize the browser, it stopped working after few trigger.

Accepted Solutions (0)

Answers (0)