private Sub Session_timeout(b As Boolean)
Log("user timedout at @ "& DateTime.Time(DateTime.Now))
' Do whatever you need to handle the time out, e.g.
B4xpages.MainPage.UserTimeout
End Sub
private Sub session_restart(b As Boolean)
' This event is unecessary, but shows you that the system is working
Log("User did something @ "& DateTime.Time(DateTime.Now))
End Sub
#if java
import android.os.Handler;
@Override
public void onUserInteraction() {
super.onUserInteraction();
// This is where you set the duration of the timeout - 10 - 10 minutes
delayedIdle(10);
}
Handler _idleHandler = new Handler();
Runnable _idleRunnable = new Runnable() {
@Override
public void run() {
processBA.raiseEventFromUI(this,"session_timeout",true);
}
};
private void delayedIdle(int delayMinutes) {
_idleHandler.removeCallbacks(_idleRunnable);
_idleHandler.postDelayed(_idleRunnable, (delayMinutes * 60 * 1000));
processBA.raiseEventFromUI(this,"session_restart",true);
}
#end if