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
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
unfortunately i cant tell you how you can call the dialog. I never coded something for a mobile project
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
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.
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.
File a bug report then, please.
QNetworkSession *session = new QNetworkSession(QNetworkConfigurationManager::defaultConfiguration());
Opening session should handle displaying connection dialog if needed.