One time prompt when user opens the app

Need help on how to implement the logic behind a ‘one time prompt’?

  1. A warning message that displays only the first time the user opens the app.
  2. A warning that informs the user that without internet connection the app wont work. This needs to be triggered only when wifi/4g is not available (this is a bonus feature that its not a one time prompt).

Thanks in advance

You can do this locally on the device like this:

  1. On Global Canvas App launched event, attempt to “Get item from storage” with some key, e.g. oneTimePrompt
  2. If 2nd output (there is no record with the key) → display the prompt → “Set item to storage” with the key oneTimePrompt and any data.
  3. When app opens for a 2nd time the record will be found and the 1st output of “Get item from storage” triggers → nothing happens

Alternatively, you can save the information to your database and use a similar logic to fetch it when the app is launched.

Hi Mari
thanks for your reply. From the preview app it works like a charm. I think it will be ok in the build also.

How can I achieve the warning (internet connection required…etc) when there’s no internet connection? At any given time that data connection drops.

You can use systemVars.networkStatus for that.

I used it with no success. I don’t know if my logic is right.

(The IF in Dialog Node is an appvar which changes sees the chosen language by the user).

The correct formula is systemVars.networkStatus=="none" || systemVars.networkStatus=="unknown" with the OR logic operator.

With && (AND) it will never evaluate to true, since networkStatus only has one value at a time. Also the IF statement is redundant, since the logic clause already gives you a true/false value. :slight_smile:

Hi Mari,
being a noob didn’t know the difference between && and ||, so now its works. What I would like though, is to have a pop-up whenever the internet disconnects. The warning only works when the app opens from a cleared memory state and there’s no internet. If you disconnect the data from within the app, there’s no warning. Is it possible to make a pop-up?

Hi, to account for that case, you could make a loop that checks for the internet state using the Delay node:

This did the trick. You have answered all my questions Mari, thank you.
One problem I’m facing in the final build though, is that the app needs almost 20 sec to initialize. Remove the logic and its lighting fast. Is there a way to bypass that delay?

Are you able to pinpoint if the logic that slows it down is from the record getting or the loop? You could try moving the logic to another place, for example first page “Page mounted”, so that it runs only when the app has already been launched. Also check the delay, the default is 500ms (twice per second), which is too often for your use case.

Will try and report back. Thanks

1 Like

So, I moved the logic of ‘one time prompt’ on the 1st page and the ‘internet connection warning’ on the global canvas (with a 2sec delay) and everything works as it should but the initial lag when opening the app is still there.
When the app is on the background it open pretty fast but as soon as I kill the process it needs around 20sec to initialize.
One other thing is the package size (as I have mentioned before), I don’t know if there are news regarding this issue?