<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hi Dylan,<br>
    </p>
    <p>From QML, the easiest way is probably to monitor
      /run/state/providers/connman/Internet/NetworkState and
      /run/state/providers/connman/Internet/NetworkType with
      ContextProperty object. Google for "qml contextkit
      contextproperty" to find some examples. That way, statefs monitors
      connman state for you and you monitor statefs.<br>
    </p>
    <p>You can achieve the same result by directly monitoring the
      connman state over D-Bus. Then libconnman-qt is your friend. It's
      a C++ library with a QML plugin (MeeGo.Connman). That requires a
      bit more code but takes statefs out of the picture.</p>
    <p>There are also Qt network configuration APIs but those are even
      more complicated and not all of those might work the way you would
      expect them to work. But this is the most platform-independent API
      in case if that is important for you (probably not). Internally it
      also talks to connman.<br>
    </p>
    <p>Connection selector has a D-Bus API which is easy enough to
      figure out with dbus-monitor. However it's not an official API and
      it's more or less guaranteed to change over time and break your
      app. Think twice before starting to use it.<br>
    </p>
    <p>Cheers,<br>
      -Slava<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 08/10/16 11:59, Dylan Van Assche
      wrote:<br>
    </div>
    <blockquote
cite="mid:4vKau7Ghc9RA9MrWlMilP9OlzTSBWy6Pa8BWLvl18nQ6CtcYxkKaRMJT4XU53O9OL0aubekXhO6NvSB_EdVman5i5IQouohOXusGYN-la4M=@protonmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <div>Hi Sailors,<br>
      </div>
      <div><br>
        For my app Sailfinder I have received a bug report about the
        network connection. When switching between mobile data &
        WiFi the app misbehaves.</div>
      <div><br>
        I want to detect the current network state to avoid thsi
        problem. I thought of several possibilities:</div>
      <ul>
        <li>
          <div>Ping everytime to my website before doing other requests
            (expensive, better not).<br>
          </div>
        </li>
        <li>Use MCE module which expose the network states in a file
          (that's what I found on the sailfishos.org website, no more
          extra information). This option is the one I want to try :)<br>
        </li>
        <li>
          <div>...<br>
          </div>
        </li>
      </ul>
      <p>And if network isn't available I want to show the network
        connection dialog but I haven't find any information about it.
        Can someone help me with it? If possible, in a Harbour way since
        Sailfinder is also available in the Jolla Store.<br>
      </p>
      <div>Kind regards,<br>
      </div>
      <div>Dylan Van Assche<br>
      </div>
    </blockquote>
    <br>
  </body>
</html>