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. How to get GPS data via Android API?
Forum Updated to NodeBB v4.3 + New Features

How to get GPS data via Android API?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 4 Posters 973 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on 3 Jun 2019, 12:16 last edited by
    #1

    Hi!
    How to get GPS data via Android API?

    R 1 Reply Last reply 3 Jun 2019, 13:02
    0
    • M Mikeeeeee
      3 Jun 2019, 12:16

      Hi!
      How to get GPS data via Android API?

      R Offline
      R Offline
      raven-worx
      Moderators
      wrote on 3 Jun 2019, 13:02 last edited by raven-worx 6 Mar 2019, 13:03
      #2

      @Mikeeeeee
      so it seems you are repeatedly trying keep your questions to a minimum amount of words and as generic as possible?

      I advice you to do a Google/forum search first ... and then come back with a more specific question.

      --- 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
      4
      • K Offline
        K Offline
        kuzulis
        Qt Champions 2020
        wrote on 3 Jun 2019, 13:34 last edited by
        #3

        Here an ansver.

        1 Reply Last reply
        2
        • M Offline
          M Offline
          Mikeeeeee
          wrote on 4 Jun 2019, 07:24 last edited by
          #4

          In Android, this makes the class public class Address and the functions double getLatitude() and double getLongitude().
          https://developer.android.com/reference/android/location/Address
          I added #include <Qt Android Extras> and QT += android extras to the project. But how to call the necessary functions?

          K 1 Reply Last reply 4 Jun 2019, 07:37
          0
          • M Mikeeeeee
            4 Jun 2019, 07:24

            In Android, this makes the class public class Address and the functions double getLatitude() and double getLongitude().
            https://developer.android.com/reference/android/location/Address
            I added #include <Qt Android Extras> and QT += android extras to the project. But how to call the necessary functions?

            K Offline
            K Offline
            KroMignon
            wrote on 4 Jun 2019, 07:37 last edited by
            #5

            @Mikeeeeee Before trying to do something, I try to find documentation. So a simple search on google/bing/wathever of "qt android gps" will give you a link to Qt Positioning

            Qt Positioning
            The Qt Positioning API provides positioning information via QML and C++ interfaces.
            Currently the API is supported on Android, iOS, macOS, Linux (using GeoClue version 0.12.99), Windows (with GPS receivers exposed as a serial port providing NMEA sentences), and WinRT (using Windows.Devices.Geolocation). Note that the WinRT implementation can also be used in Win32 Desktop uses cases if the underlying platform is Windows 10 or later.

            It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

            1 Reply Last reply
            2
            • M Offline
              M Offline
              Mikeeeeee
              wrote on 4 Jun 2019, 08:22 last edited by
              #6

              I create:

              public:
                  explicit MainWindow(QWidget *parent = nullptr);
                   ~MainWindow();
                  QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
              
              
              private slots:
                  void on_testButton_clicked();
                  void positionUpdated(const QGeoPositionInfo &info)
                  {
                      qDebug() << "Position updated:" << info;
                  }
              

              How to call positionUpdated and get the data?

              1 Reply Last reply
              0
              • M Offline
                M Offline
                Mikeeeeee
                wrote on 4 Jun 2019, 08:27 last edited by
                #7

                but this works:

                    if (source)
                    {
                        connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
                                this, SLOT(positionUpdated(QGeoPositionInfo)));
                        source->startUpdates();
                    }
                
                1 Reply Last reply
                0

                1/7

                3 Jun 2019, 12:16

                • Login

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