Returning to home screen after last action

I have created a 1 screen app that tells your fortune (like the tutorial), but I want the user to return to the initial screen after she/he has read their fortune. At the moment, after reading their fortune the user can shake the phone as many times as they want. So ideally I want them to either return to the home screen OR have a message that says "try again tomorrow" then close the app. But i am getting confused.

You can use a Notifier.ShowChooseDialog. Set one button "Back" and when it is chosen, you close the screen and return to the previous one. And the other button to "Exit" and if chosen, close the app.

If you want to restrict the user to one fortune a day, save today's date toTinyDB tag LastFortuneDate after giving a fortune.

Before giving a fortune, make sure that tag's value is not already today's date.

1 Like