×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    5

    Location API wont provide positions

    Hi, I'm trying to use the location APIs on a N8 (using Symbian Belle). The app works great on the emulator, but it never resolves positions on the device. As far as I can see, the device can locate, since the Maps App can easily find my position when I use it.

    My .pro file contains:
    Code:
    symbian {
        TARGET.UID3 = *redacted*
        TARGET.CAPABILITY = Location LocalServices ReadUserData NetworkServices UserEnvironment WriteUserData
    }
    
    QT += network mobility
    CONFIG += mobility qt-components
    MOBILITY = systeminfo location
    And I'm using the following QML to get the position:

    Code:
        PositionSource {
            id: positionSource
            active: true
            updateInterval: 5000
    
            onPositionChanged: {
                console.log(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude);
            }
        }
    I also tried to get the position using C++. I created a class that I call on main to handle this, and I always get exactly one timeout message on the output. The relevant code is:

    Code:
    void QMLGeoServiceProvider::init() {
    
        source = QGeoPositionInfoSource::createDefaultSource(this);
        if (source == NULL) {
            qDebug() << "Cant get a position source. RUN!";
        } else {
    
            qDebug() << "connecting stuff";
            connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(positionUpdate(QGeoPositionInfo)));
            connect(source, SIGNAL(updateTimeout()), this, SLOT(updateTimeout()));
    
            source->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
            source->setUpdateInterval(1000);
            source->startUpdates();
            source->requestUpdate();
        }
    }
    
    void QMLGeoServiceProvider::updateTimeout() {
        qDebug() << "Failed to update the position";
    }
    
    void QMLGeoServiceProvider::positionUpdate(QGeoPositionInfo info) {
        qDebug() << "Yay!";
    }
    Does anyone have any idea why this isnt working?

    Thanks,
    Juan

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,169

    Re: Location API wont provide positions

    I would have one readymade example that should be working, just check the last one at: http://www.developer.nokia.com/Commu..._Maps_Examples

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    5

    Re: Location API wont provide positions

    I ran the My Location Map example on the device, and it can't find the current position either. I'd expect the examples posted there to work, so I'm starting to doubt the device. I'm going to see if I can get another device to confirm if the issue is isolated to the device.

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: Location API wont provide positions

    check device setting. i.e. obtain gps position methods list
    how long you've waited for coordinates?
    in case of cold start and with agps turned off it can takes minutes
    Symbian & Qt developer. http://vladest.org

  5. #5
    Registered User
    Join Date
    Dec 2011
    Posts
    5

    Re: Location API wont provide positions

    By the GPS methods you mean the list of source provided by QGeoPositionInfoSource, it seems to be empty. However, since the object itself is being created, that means there's a default source that is not required to show up in the list (according to the docs).

    And I waited quite a long time. Also, I ran the maps app first, let it get a fix, and then ran my app (without closing maps) and I still didn't get a position.

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    29

    Re: Location API wont provide positions

    Quote Originally Posted by jpcivile View Post
    Hi, I'm trying to use the location APIs on a N8 (using Symbian Belle). The app works great on the emulator, but it never resolves positions on the device. As far as I can see, the device can locate, since the Maps App can easily find my position when I use it.
    Let me hook in here. I have a similar problem since updating the device to Anna. Or switching to Qt 4.7.4. Not sure what it is, here's what happens: In the past, the app would pick up GPS locations just fine. Now I run into the equivalent of your updateTimeout(). Unless, I've ran Ovi Maps before. In this case, the underlying location management seems to hold the GPS receiver and my app works as before. It's as if my app cannot activate GPS, only listen into it, if already activated elsewhere. Anybody have an idea what's going on? Perhaps what you see as well?

  7. #7
    Registered User
    Join Date
    Apr 2009
    Posts
    506

    Re: Location API wont provide positions

    btw, what QtMobility version you uses?
    Symbian & Qt developer. http://vladest.org

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    29

    Re: Location API wont provide positions

    I am including headers of QtMobility version 1.2.1

  9. #9
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Location API wont provide positions

    Hi,
    Coudl you try this example mentioned in page http://doc.qt.nokia.com/qtmobility-1...#update-method
    You can try to use positionSource.start() method also.

    At least with Belle SW it works for me.

  10. #10
    Registered User
    Join Date
    May 2010
    Posts
    29

    Re: Location API wont provide positions

    The was covered... What I found however is a difference in the handling of location timeouts (methinks). After changing the update timeout behavior things are back in order.

  11. #11
    Registered User
    Join Date
    Apr 2005
    Posts
    55

    Re: Location API wont provide positions

    Hi mahbub_s60
    I have tried this example on Nokia 701 with Belle and C7 with Anna. The speed that it displays is always changing. I put my phone on the windows of my room. The speed goes like this 1.1 , 0.3, 0.5, 1.0, 2.3, 2.7, .... (this is all in meters per second) and the phone is always on the window not moving. I also try walking down the street and the differences are similar. I am walking at constant speed and phone is showing deviation of 3 m/s.
    Is this normal?

    How can I get GPS signal Quality from within QML?

  12. #12
    Super Contributor
    Join Date
    Mar 2008
    Posts
    1,481

    Re: Location API wont provide positions

    Quote Originally Posted by Tslv View Post
    Hi mahbub_s60
    I have tried this example on Nokia 701 with Belle and C7 with Anna. The speed that it displays is always changing. I put my phone on the windows of my room. The speed goes like this 1.1 , 0.3, 0.5, 1.0, 2.3, 2.7, .... (this is all in meters per second) and the phone is always on the window not moving. I also try walking down the street and the differences are similar. I am walking at constant speed and phone is showing deviation of 3 m/s.
    Is this normal?

    How can I get GPS signal Quality from within QML?
    I guess your observation is right. GPS in phone is not 100% accurate, there are deviation from actual result. If you are in open sky you may get better result.
    Qt mobility provide network based (not precise ) and satelite based (more precise).

    By using this QML example you can set positioning source, take a look in the source code.
    http://www.developer.nokia.com/Commu...ocoding_in_QML

  13. #13
    Registered User
    Join Date
    Apr 2005
    Posts
    55

    Re: Location API wont provide positions

    Hi mahbub_s60,
    I am aware that GPS is not 100% accurate. Nobody's perfect, right?
    I was just wondering how are other apps like apps that show GPS speed or maybe Nokia Maps have speed that doesn't change so often? It seems like the speed is more constant there? Are they showing average speed? Adding last 3 speeds and divining them by 3? Or is there some better way for this?

    Also when I call
    printableMethod(positionSource.positioningMethod)
    I get Positioning method Satelite

    PrintableMethod is a function from the example code from the URL you posted here earlier
    doc.qt.nokia.com/qtmobility-1.2/qml-positionsource.html
    Last edited by Tslv; 2012-01-30 at 16:54.

  14. #14
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,569

    Re: Location API wont provide positions

    On devices with an accelerometer, it could be used to complement GPS data for speed/movement.

  15. #15
    Registered User
    Join Date
    Apr 2005
    Posts
    55

    Re: Location API wont provide positions

    Hi petrib
    Is there a method/function/object or component in QML that already does that?

    If not how should I write one?
    If the mobile phone is laying down on my window it is easy. I only check if Z axis has constant gravity force pulling phone down. X and Y should feel no acceleration force. If that is true I could override speed reading I get from Positioning element and I could write that current speed is 0.
    But what if I am walking and what if I am in the car? How can accelerometer help me here? It can tell me I am moving but it won't tell me with what speed?
    Also if I am standing in one place and I am holding phone in my hand I cannot override speed reedings from GPS and write Speed = 0 because my hand has micro movements.

Similar Threads

  1. Replies: 12
    Last Post: 2012-11-30, 06:57
  2. Is it possible to change the positions in a MorphingMesh?
    By MobileVisuals in forum Mobile Java Media (Graphics & Sounds)
    Replies: 5
    Last Post: 2011-12-13, 14:43
  3. Symbian ^3 0.8 and Qt 4.6.3 wont work together without patching wont link
    By jimgilmour1 in forum Tools and SDK Feedback (Closed)
    Replies: 3
    Last Post: 2010-07-20, 08:04
  4. UI and default positions
    By mdn04 in forum Mobile Java General
    Replies: 2
    Last Post: 2009-05-30, 22:55

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×