On 03/28/2011 07:45 PM, ext Harri Pasanen wrote:
> I went for a walk with a real device, E7, in offline mode, not even a SIM card
> is installed.
>
> After Nokia Maps picked my location via GPS, it took a while before
> lastKnownPosition() started returning the new locations, like tens of seconds.
>
> I have a button in UI that calls this snippet of code:
>
> if (_posSource) {
>     _posSource->requestUpdate(0);
>     QGeoPositionInfo pos = _posSource->lastKnownPosition();
>     if (pos.coordinate().isValid()) {
>       // came here all the time, but position timestamp and coordinates where
>         // for
>       ....
>
>
> Qt 4.6.3, Mobility 1.0.2
>
> So any idea why there is this delay in updating lastKnownPosition, even after
> the hardware obviously has a GPS fix?
>
> Thanks,
>
>
> Harri
> http://mpaja.com/

Hi,

The pause is probably because you're calling lastKnownPosition before 
the Location API has a first position.

It's the last known position reported to the current application  which 
means it will have to get a fix and what for a position to come in if 
the app hasn't done that already.

That's not really how it's meant to be used so it might not be the most 
efficient.

Do things improve if you connect the positionUpdated signal of 
QGeoPositionInfoSource to a slot?  I.e. if your button would just call
   _posSource->requestUpdate(0);
and the slot handles the position info when it comes in.

Cheers,

Dave
_______________________________________________
Qt-mobility-feedback mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-mobility-feedback

Reply via email to