B4J Question Problem with b4j login timeout

Discussion in 'B4J Questions' started by PikeDr, May 31, 2019.

  1. PikeDr

    PikeDr Member Licensed User


    I have a problem with the server variables for login from b4a to b4j. I control the user login using the following variable:
    - req.GetSession.GetAttribute ("User_Registration").

    Apparently everything is correct, but after about 60 seconds of inactivity, the variable becomes null. Does somebody knows why it could be?
  2. Erel

    Erel Administrator Staff Member Licensed User

    Are you calling GetSession.Invalidate in your code?

    Sessions should not expire by default. You can configure it with Session.MaxInactiveInterval.
  3. PikeDr

    PikeDr Member Licensed User

    Hi Erel,

    Sorry for the delay... I have checked the variable "Session.MaxInactiveInterval" value and is -1.

    And I nerver call to GetSeeion.Invalidate.

    Any other idea?
  4. Erel

    Erel Administrator Staff Member Licensed User

    You need to provide more information. I guess that the browser deleted the cookie which then caused a new session to be created.

    You can check the IsNew parameter to see it.
  5. PikeDr

    PikeDr Member Licensed User

    Hi Erel,

    I think I have discovered the problem, i will try to explain it.

    Some phone manufacturers(Nokia, Xiaomi, OnePlus,...), incorporate in their software an option to close applications in the background, related to the use of energy saving and ram. For this reason, when you block your phone, the services of some apps are stopped.

    In my case, i am using a Xiaomi, and to solve the problem simply had to configure the app in "Background Configuration" mode as "No Restrictions".

    Do you know if there is a possibility for to do this action automatically? or how to prevent this behavior of the app?

    Excuse my poor English
  6. OliverA

    OliverA Expert Licensed User

  7. DonManfred

    DonManfred Expert Licensed User

    No, you can not do it automatically. You need to ask the user to do it.
    You can not prevent it.
    OliverA likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice