Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt check Internet connection*
QtWS25 Last Chance

Qt check Internet connection*

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 7 Posters 25.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zolakt
    wrote on last edited by
    #1

    Hi,

    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

    1 Reply Last reply
    0
    • F Offline
      F Offline
      Felix
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zolakt
        wrote on last edited by
        #3

        yes i know
        but I still need to bring up the connection dialog if there is no connection active

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Felix
          wrote on last edited by
          #4

          unfortunately i cant tell you how you can call the dialog. I never coded something for a mobile project

          1 Reply Last reply
          0
          • H Offline
            H Offline
            harryF
            wrote on last edited by
            #5

            Check the qt mobility examples, e.g. the flickrdemo

            // happy hacking

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              zolakt
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jeremy.katz
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                0
                • R Offline
                  R Offline
                  remy_david
                  wrote on last edited by
                  #8

                  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.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    andre
                    wrote on last edited by
                    #9

                    File a bug report then, please.

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      tomma
                      wrote on last edited by
                      #10

                      Use "QNetworkSession":http://qt-project.org/doc/qt-4.8/qnetworksession.html

                      @
                      QNetworkSession *session = new QNetworkSession(QNetworkConfigurationManager::defaultConfiguration());
                      session->open();
                      @

                      Opening session should handle displaying connection dialog if needed.

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved