I use the following code to get GeoLocation for my application
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this); if (source) { source->setUpdateInterval(1000); // time in milliseconds source->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods); connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdated(QGeoPositionInfo))); source->startUpdates(); source->requestUpdate(30000); const QGeoPositionInfo &info =source->lastKnownPosition(); ui->label->setText(QString("Latitude - %1 Longitude - %2").arg(info.coordinate().latitude()).arg(info.coordinate().longitude())); }
This code works fine on Simulator and gives me the coordinates provided by the simulator, however it does not work when I try to run it on my N900. It returns Nan instead of the latitude and longitude coordinates. The current GPS signal on the phone is brute precision. Also, geolocation works in the OVI Maps application by phone. Any idea why the above code cannot get geolocation on the phone, but works fine on the simulator?
positionUpdated(), . requestUpdate() positionUpdated(). - , requestTimeout(), , , . , lastKnownPosition(), , . , , , requestUpdate() , , , source->lastKnownPosition.isValid(), , .
positionUpdated()
requestUpdate()
requestTimeout()
lastKnownPosition()
source->lastKnownPosition.isValid()
positionUpdated() , . , .
positionUpdated() ?
Source: https://habr.com/ru/post/1765588/More articles:How to automatically insert the last menu item in the right corner? - cssNSMutableArray arrayWithArray: vs initWithArray: - objective-cHow can I debug HTTP sessions using Fiddler, as with TcpTrace? - httpadding jQuery to an ASP.NET MVC application - jqueryAdding a command column to jqGrid in Asp.Net MVC - commandGeneral approach for signing files without PE - signingFunction Modifier Order in C # - syntaxСлужба WCF - Пользовательский директор - wcfКак сохранить соотношение в одной переменной и прочитать его в С# - c#How to choose ORM - phpAll Articles