Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Getting current location GPS
Forum Updated to NodeBB v4.3 + New Features

Getting current location GPS

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wilson_chan
    wrote on last edited by
    #1

    Hi all,

    I’m writing an application that needs to get the current location of the user using QtMobility and PositionSource QML element. The code is working well with our testing Nokia 700 device; however, seems to be unable to get the current location on Symbian devices. I’ve tried with a very simple example on the documentation like:

    main.qml
    @import QtQuick 1.1
    import QtMobility.location 1.2

    Rectangle {
    id:page
    width : 250
    height: 350
    PositionSource {
    id: positionSource
    updateInterval: 1000
    active: true
    // nmeaSource: "nmealog.txt"
    }
    Column {
    Text {text: "<==== PositionSource ====>"}
    Text {text: "positioningMethod: " + printableMethod(positionSource.positioningMethod)}
    Text {text: "nmeaSource: " + positionSource.nmeaSource}
    Text {text: "updateInterval: " + positionSource.updateInterval}
    Text {text: "active: " + positionSource.active}
    Text {text: "<==== Position ====>"}
    Text {text: "latitude: " + positionSource.position.coordinate.latitude}
    Text {text: "longitude: " + positionSource.position.coordinate.longitude}
    Text {text: "altitude: " + positionSource.position.coordinate.altitude}
    Text {text: "speed: " + positionSource.position.speed}
    Text {text: "timestamp: " + positionSource.position.timestamp}
    Text {text: "altitudeValid: " + positionSource.position.altitudeValid}
    Text {text: "longitudeValid: " + positionSource.position.longitudeValid}

        Text {text: "latitudeValid: "  + positionSource.position.latitudeValid}
    
    
        Text {text: "speedValid: "     + positionSource.position.speedValid}
    }
    function printableMethod(method) {
        if (method == PositionSource.SatellitePositioningMethod)
            return "Satellite";
        else if (method == PositionSource.NoPositioningMethod)
            return "Not available"
        else if (method == PositionSource.NonSatellitePositioningMethod)
            return "Non-satellite"
        else if (method == PositionSource.AllPositioningMethods)
            return "All/multiple"
        return "source error";
    }
    

    }@

    untitled.pro
    @

    Add more folders to ship with the application, here

    folder_01.source = qml/bcard
    folder_01.target = qml
    DEPLOYMENTFOLDERS = folder_01

    Additional import path used to resolve QML modules in Creator's code model

    QML_IMPORT_PATH =

    symbian:TARGET.UID3 = 0xE63F200B

    Smart Installer package's UID

    This UID is from the protected range and therefore the package will

    fail to install if self-signed. By default qmake uses the unprotected

    range value if unprotected UID is defined for the application and

    0x2002CCCF value if protected UID is given to the application

    #symbian:DEPLOYMENT.installer_header = 0x2002CCCF

    Allow network access on Symbian

    #symbian:TARGET.CAPABILITY += NetworkServices
    symbian:TARGET.CAPABILITY += NetworkServices Location

    If your application uses the Qt Mobility libraries, uncomment the following

    lines and add the respective components to the MOBILITY variable.

    CONFIG += mobility
    MOBILITY += location

    Speed up launching on MeeGo/Harmattan when using applauncherd daemon

    CONFIG += qdeclarative-boostable

    Add dependency to Symbian components

    CONFIG += qt-components

    The .cpp file which was generated for your project. Feel free to hack it.

    SOURCES += main.cpp

    Please do not modify the following two lines. Required for deployment.

    include(qmlapplicationviewer/qmlapplicationviewer.pri)
    qtcAddDeployment()
    @

    I can see the GPS symbol is activated on the device;
    However the data getting is as below:

    <====PositionSource====>
    positioningMethod :Satellite
    nmeaSource:
    updateInterval:1000
    active:true
    <====Position====>
    latitude:NaN
    longitude:NaN
    altitude:NaN
    speed:-1
    timestamp: Invalid Date
    altitudeValid: false
    longitudeValid: false
    latitudeValid: false
    speedValid: false

    Have someone met this issue before? May I know how to fix it and get all the data correctly?
    Thank you.

    Thanks,

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved