I have a profile on which the enter tasks sometimes runs but the exit doesn't.
(i've posted this here before but can't find it directly and this was marked solved because after a reboot it worked well for a while)
The profile is quite simple:
It detects if certain celltowers are present and then enters the enter task in which a few variables are set.
One of these variables then triggers another profile to start Location Service (it used to be all in one enter task but it was easier to follow when seperated).
If the phones loses all of the dedicated cell towers, it should fire the exit task.
The exit task resets the same variables and this then triggers the Location Service profile to stop the service.
But sometimes this doesn't 100% work.
I had a suspicion that the enter task ran more then the exit task.
For this to be tested i first added a variable named count which i counted up when the enter task was executed and counted down when the exit task was executed.
If the profile was not active, the counter should always have showed 0 as value (both enter and exit tasks ran the same number of times). This was not always the case.
I then replaced the count variable with an enter variable when the enter task was ran and an exit variable when the exit tasks had run.
The variable result should have both variables give the same number of counts after the profile got inactive.
This again is not always the case.
For the moment, the enter task ran 164 times, the exit task 161 times but the profile is still active so when it goes inactive,
the exit variable will count one up to 162 but instead it should show 164 if all worked well.
This means that over the last couple of days, the enter task ran 2 times more then the exit task.
I know an enter task has a higher priority then an exit task.
I would like to know what happens when:
- 1: A profile gets inactive when the enter task still runs (i assume that the exit task will run as soon as the enter task has finished)?
- 2: When a profile gets active, then enter task runs and while running the profile switches from active to not active and back to active again in the timespan the enter task runs... what happens then?
Does the enter task run twice without the exit task or does the second trigger of the profile prevents the exit task from running since the next task has a higher priority?