Notifier not working as intended, multiple notifiers pop up consecutively(help in understanding the flow would be appreciated)

It is intended for checking whether the mobile phone is connected to internet. Since I didn’t know how to test it without building the app, I decided to use some buttons to mimic the scenario of internet connectivity being ON or OFF. so in the actual code global test would be HTTP status code received after trying to reach https// I wanted to have 2 types of pop-ups:

  1. To show that the app will check for connectivity again in 10 seconds (3 times)
  2. If there was no positive response after trying for 3 times then show a pop-up to exit the app

Also, if there was connectivity detected within those 3 times, then an alert message to show that the mobile phone is back online.

internet_trial is the no. of times that i’ve tried to reach (Max. 3 times, but if the user wishes to wait for more time, then resetting the internet_trial to 0 so that it can again go for 3 times b4 showing exit app pop-up)

Now the problem that I’m facing is when the internet_trial reaches 3 it shows the pop up for checking again followed by pop-up for exiting the app while it should only display the pop-up for exiting the app. Below is the code snippet.

There’s some silly boundary condition that I’m overlooking and I would really appreciate a second pair of eyes! Thanks!!

1 Like

Hi Somasundharam

One of the best explained problems I have seen this year! :sunglasses:

Since your App is testing very frequently, Notifier pop-ups are not appropriate - instead use a permanent label to display status.

1 Like

Hi Chris,
I tried to work with label, but still it was skipping the condition for when internet_trial reached 3 , so i just added added clock.timerInterval to every if-else block and specified the required time and it seems to work fine (like I intend it to). I wonder what the reason would be? Would like to get your insights too!


Actually, I’m surprised it works - you are resetting the timer interval, mid timer interval. Also, the Notifiers effectively interrupt the process, so what happens to time duration is artificially controlled, it’s unwittingly in the hands of the User.

Is the actual internet check (ping?) being performed in another clock timer block?

No, there’s only one timer, internet_checker_clock for pinging. It’s funny how i ended up with these blocks, I was copy pasting the blocks for the first two conditions, and suddenly I was able to get the correct msg in the label for all conditions, and then I thought, lets try notifs too and here we are!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.