[SailfishDevel] How can I check if there's internet connection already on? To avoid extra connection request dialogs

Piotr Tworek tworaz666 at gmail.com
Sat Jan 24 14:36:24 UTC 2015


Hi Artem,

Not sure if this is the best way, but you can connect to
QNetworkConfigurationManager::onlineStateChanged signal. This is what I
did in YTPlayer and it works well enough. You can see it in
https://github.com/tworaz/sailfish-ytplayer/blob/master/src/YTNetworkManager.cpp.
Based on that you could just implement a simple queuing mechanism for
your requests. I also have something like this for video downloads
(https://github.com/tworaz/sailfish-ytplayer/blob/master/src/YTLocalVideoManager.cpp).


/ptw

> Hi All
> 
> I have some data that needs to be communicated over network, but can
> wait for a while: updating feeds in the background, synching high
> scores, sending stats, etc.
> 
> These things need to be communicated at some point, but can easily be
> delayed without any big harm and I don't want to pop a multitude of
> "Connect me!" dialogs in front of the users without much need.
> 
> Can I somehow check whether internet connection is already established
> and/or monitor connection state to notice when it's on?
> 
> Cheers,
> Artem.
> 
> P.S.
> In MeeGo (and I think in iOS nowadays too) there was a way to tell to OS
> that you want to communicate over net "some time soon" and OS was
> bundling such requests to happen together. There isn't anything like
> that in Sailfish OS, is there?
> 
> -- 
> Artem Marchenko
> http://agilesoftwaredevelopment.com
> http://twitter.com/AgileArtem
> 
> 
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
> 



More information about the Devel mailing list