Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User campbeltonian's Avatar
    Join Date
    May 2010
    Posts
    1
    Hi guys,

    I'm trying to write an application that gets the location of the phone using the 'Network based' positioning method.

    Unfortunately, setting the preferred positioning method to 'NonSatellitePositioningMethods' doesn't seem to have any effect, even though calls to supportedPositioningMethods() return the 'AllPositioningMethods' flag.

    I'm running my program on a Nokia N95 with Qt Mobility 1.0.0 installed, indoors (therefore no GPS reception) but with good network reception.

    If I edit the positioning methods in the phone's settings app so that only 'Network based' is available, the following code returns a network-based location.

    However, if I enable 'Assisted GPS' in the phone's settings, my preferred positioning method setting is ignored, the phone attempts to use GPS, and the position request times out.

    Is this a bug, or am I just doing it wrong?

    Code:
    Positioning::Positioning(QObject *parent)
        : QObject(parent)
    {
        QGeoPositionInfoSource *positionManager = QGeoPositionInfoSource::createDefaultSource(this);
        positionManager->setPreferredPositioningMethods(QGeoPositionInfoSource::NonSatellitePositioningMethods);
    
        connect(
                positionManager, SIGNAL(positionUpdated(QGeoPositionInfo)),
                this, SLOT(positionUpdated(QGeoPositionInfo))
                );
        connect(
                positionManager, SIGNAL(updateTimeout()),
                this, SLOT(updateTimeout())
                );
    
        positionManager->requestUpdate(30000); // time out after 30 seconds
    }
    
    void Positioning::positionUpdated(QGeoPositionInfo position)
    {
        qDebug() << "Position request succeeded.";
    }
    
    void Positioning::updateTimeout()
    {
        qDebug() << "Position request timed out.";
    }
    Last edited by campbeltonian; 2010-05-04 at 15:18. Reason: Forgot to mention return value of supportedPositioningMethods()

Similar Threads

  1. 编译Qt样例出错,请看如下
    By TD3 in forum [Archived] Qt General ( Qt技术)
    Replies: 14
    Last Post: 2009-12-24, 03:23
  2. Privacy functions in Location Based Browsing in i-mode
    By k41s in forum Geolocation and Navigation
    Replies: 1
    Last Post: 2009-09-04, 11:43
  3. E62 Location using Network Based
    By felipe.correa in forum Geolocation and Navigation
    Replies: 0
    Last Post: 2008-04-26, 16:32
  4. Network based location in Python?
    By miohtama in forum Python
    Replies: 4
    Last Post: 2007-12-31, 09:40
  5. Welcome to Location Based services section!
    By seppo_fn in forum Geolocation and Navigation
    Replies: 0
    Last Post: 2007-06-29, 07:23

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved