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 978 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 last edited by
    #1

    Hi!
    How to get GPS data via Android API?

    raven-worxR 1 Reply Last reply
    0
    • M Mikeeeeee

      Hi!
      How to get GPS data via Android API?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #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 last edited by
        #3

        Here an ansver.

        1 Reply Last reply
        2
        • M Offline
          M Offline
          Mikeeeeee
          wrote on 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?

          KroMignonK 1 Reply Last reply
          0
          • M Mikeeeeee

            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?

            KroMignonK Offline
            KroMignonK Offline
            KroMignon
            wrote on 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 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 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

                • Login

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