Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt check Internet connection*
I'm working on a project for Maemo and Symbian on C++/Qt
Can someone tell me how can I just check if there is a active Internet connection in Qt? If active start the app, if not display the choose connection dilaog.
I see I have to do this with Bearer Managment which is implemented in Qt 4.7, but I'm a little lost in the documentation
Felix last edited by
you could also do it with QNetworkAccessManager. Just make a Http request on a very active site (e.g. www.google.com) when the reply is finished, it has an error code. When this ErrorCode == QNetworkReply::NoError you can assume an internet connection.
I know this is not the best solution, but a simple one
yes i know
but I still need to bring up the connection dialog if there is no connection active
Felix last edited by
unfortunately i cant tell you how you can call the dialog. I never coded something for a mobile project
harryF last edited by
Check the qt mobility examples, e.g. the flickrdemo
thank for advice
but that example won't do
bearer magement has been moved from mobility to qt since 4.7
not all the things are the same
i found some documentation on "http://doc.qt.nokia.com/4.7-snapshot/bearer-management.html":http://doc.qt.nokia.com/4.7-snapshot/bearer-management.html
but as i said, i'm a little lost in the documentation
i don't get how to accomplish just to make a check, and call the dialog if needed
jeremy.katz last edited by
Does "QNetworkConfigurationManager::isOnline()":http://doc.qt.nokia.com/4.7-snapshot/qnetworkconfigurationmanager.html#isOnline sound like what you need?
The "bearer monitor example":http://doc.qt.nokia.com/4.7-snapshot/network-bearermonitor.html might also be of interest.
remy_david last edited by
On Symbian QNetworkConfigurationManager::isOnline() returns false even when WiFi is On and connected to internet.
I don't have any simple method to check network connectivity with Qt on Symbian.
andre last edited by
File a bug report then, please.
tomma last edited by
QNetworkSession *session = new QNetworkSession(QNetworkConfigurationManager::defaultConfiguration());
Opening session should handle displaying connection dialog if needed.