locked
networkstatuschanged event with lots of lag?

    Question

  • Hello guys.

    I've noticed that the networkstatuschanged event will fire whenever the cost or connectivity status may have changed. I've built a really simple app which handles that event and I'm only checking the internet profile to see if this changed was motivated by a change in the connectivity status. The code I'm using looks like this:

    var existeLigacao = false;
    //in the activated event, I initialize the var
    existeLigacao = networkInfo.getInternetConnectionProfile() !== null;

    and then estadoRedeMudou is called for handling the networkstatuschanged event:

    function estadoRedeMudou(e) {
        var perfil = networkInfo.getInternetConnectionProfile();
        var novoEstado = perfil !== null;
        if (novoEstado === existeLigacao) return;//sem alteracoes
        existeLigacao = novoEstado;
        div.innerHTML += "connectivity: " + (existeLigacao ? "on" : "off") + "<br>";
    }

    To test this code, I'm simply disabling and enabling the network adapter. What I'm seeing is that some times, I don't get the off message printed until I re-enable the adapter. when I do that, it will print both messages, ie, it will print off followed by on. I understand that there might be some lag between the occurrence and the event, but shouldn't I get the off message before turning on the adapter?

    thanks.


    Luis Abreu

    Tuesday, April 03, 2012 4:09 PM

Answers

  • I expect it will continue to act as it does now, only with bug fixes.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Thursday, April 05, 2012 4:00 PM
    Moderator

All replies

  • Hi Luis - there are some problems surrounding the NetworkStatusChange event firing in CP.  I expect that these will be cleared up in the next version.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Thursday, April 05, 2012 1:18 PM
    Moderator
  • Thanks for the answer Matt.

    Only one more question: will it still fire when it detects a cost change? or will it only be used when there's a change in the network connectivity?

    thanks.


    Luis Abreu

    Thursday, April 05, 2012 2:48 PM
  • I expect it will continue to act as it does now, only with bug fixes.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator

    Thursday, April 05, 2012 4:00 PM
    Moderator
  • Ok Matt.

    thanks for the reply.


    Luis Abreu

    Thursday, April 05, 2012 10:03 PM