Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Getting location data from GPS in android and ios

    Mobile and Embedded
    3
    7
    4229
    Loading More Posts
    • 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.
    • V
      vyau last edited by

      Hi: I am trying to get my location via mobile GPS and like to use Qt
      to port my app onto both android and ios. Can I read from GPS sensor in those
      mobile platforms directly via QNmeaPositionInfoSource
      (http://doc.qt.io/qt-5/qnmeapositioninfosource.html) or must
      I go through NDK (in Android) and C (in ios) to read from GPS sensor?

      thanks

      1 Reply Last reply Reply Quote 0
      • S
        Schluchti last edited by

        I am using PositionSource in my application to receive the current position, which works pretty well. (see example here: http://doc.qt.io/qt-5/qml-qtpositioning-positionsource.html)

        Want to read more about Qt?

        https://gympulsr.com/blog/qt/

        Latest Article: https://gympulsr.com/blog/qt/2017/06/14/ios-background-music-qt.html

        1 Reply Last reply Reply Quote 1
        • V
          vyau last edited by

          thanks.
          I see on the C++ side, there's a complementary API to what you suggested:

          http://doc.qt.io/qt-5/qnmeapositioninfosource.html

          It seems that I can set the source directly to read from GPS sensor by declaring
          a QIODevice(). How do I point to my GPS sensor on the phone using this class?
          I am unclear about this.

          Thanks!

          raven-worx 1 Reply Last reply Reply Quote 0
          • raven-worx
            raven-worx Moderators @vyau last edited by

            @vyau said in Getting location data from GPS in android and ios:

            I see on the C++ side, there's a complementary API to what you suggested:
            http://doc.qt.io/qt-5/qnmeapositioninfosource.html

            NMEA isn't want you want, this is just a specific position source - IIRC taken from special formatted text files

            See this

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            V 1 Reply Last reply Reply Quote 0
            • V
              vyau @raven-worx last edited by

              @raven-worx thanks, let me check out your link.

              1 Reply Last reply Reply Quote 0
              • V
                vyau last edited by

                @raven-worx Your example works. Do you have any Qt example that leverages Wifi or 4G to determine mobile phone location? Thanks

                raven-worx 1 Reply Last reply Reply Quote 0
                • raven-worx
                  raven-worx Moderators @vyau last edited by

                  @vyau said in Getting location data from GPS in android and ios:

                  Do you have any Qt example that leverages Wifi or 4G to determine mobile phone location?

                  No, i am not aware of such feature in Qt yet.
                  (But this doesn't mean that it doesn't exists)

                  --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                  If you have a question please use the forum so others can benefit from the solution in the future

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post