Hi,
I have faced with very unexpected behavior when I'm making a web request from a temporal event.
I thought it is a system limitation, that it is impossible to invoke a background delegate frequent than once in 5 min.
But it turns out that on some devices it happens every second or even a bit faster. Simulator and my own device (F5 plus) behave totally fine but in a very rare case, on my users' devices onTemporalEvent() method is invoked as a machinegun.
The background initialization method pretty standard, just as in documentation:
function InitBackgroundEvents()
{
var FIVE_MINUTES = new Toybox.Time.Duration(5 * 60);
var lastTime = Background.getLastTemporalEventTime();
if (lastTime != null)
{
var nextTime = lastTime.add(FIVE_MINUTES);
Background.registerForTemporalEvent(nextTime);
}
else
{
Background.registerForTemporalEvent(Time.now());
}
}
And InitBackgroundEvents() being called from two methods:
function getInitialView()
function onSettingChanged()
So, the question. How does it happen that only on a small number of devices temporal event being invoked once in a second and how to avoid this?
Does anybody have the same experience?