Entry and exit assistance

Hello. For example, the user is logged in and now he wants to log out of the account. If the Bide User is logged in, when he opens the application again, he should go directly to the home page and not to the login screen. But if the user clicks the logout button and exits the account, when the user opens the application, he/she will switch to the login screen.

You can achieve it by using tinydb

When user login successful, save tinydb with any tag nane as true

When user clicks logout save this same tag name value as false

Now in screen init, call this tag value.
If this is true
then open the another screen directly
Else open the login page

I did it worked but the page is constantly refreshing itself every second


what could be the problem here

Make sure whether clock block getting triggered

There is no clock on the screen but

Not in screen initialize block
It’s on the screen though

I completely deleted the watch, got the apk again and the same

If you are already in screen2 why are you opening screen2 again?


But the logic here is that if the exit button is clicked, it should stay on screen 2 when the application is reopened.

Stay is not the same as re opening.
To stay in a creen, you do nothing. If you OPEN a screen, even if it’s the same screen you are in now, the app open another instance of that screen.

Now don’t I need to add something to the else field?

The right thing to do here would be to ask if the user is logged in, then open the new screen, ELSE show a label saying NOT LOGGED IN and just stay there. I guess there will be a button lo LOG IN in that case, right?

Why you need an else? Just use a regular IF without an else.

I removed this block from Else field and it worked correctly

1 Like

I also need this, when a checkbox is checked, that is, if remember entry is clicked, the same logic should work, so if the application is opened, if the user confirms the login as remember, the user should go directly to the main page.

Then you should save in a tinydb when the user checks that checkmark.
Next time your app opens, THE VERY FIRST THING you need to check is if that tinydb value is true.
If it’s true, then do the regular login you showed before.
If it’s not true or doesn’t exist, then show the email and password fields and the “remember login” checkmark.

1 Like

All right, I’ll try them tomorrow, and if there’s a problem, I’ll get back to you. Thank you

1 Like

Thank you very much it was successful :slightly_smiling_face:

1 Like