How to get GPS data via Android API?
-
@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.
-
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? -
@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. -
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?