Getting current location on Symbian^3 (Anna, Belle) devices
-
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 N9 device; however, seems to be unable to get the current location on Symbian devices. We've tried with a very simple example on the documentation like:
main.qml
@
import QtQuick 1.1
import QtMobility.location 1.2Rectangle {
id: page
width: 350
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";
}
}
@Add more folders to ship with the application, here
folder_01.source = qml/untitled
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01Additional import path used to resolve QML modules in Creator's code model
QML_IMPORT_PATH =
symbian:TARGET.UID3 = 0xE5101660
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 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 += locationSpeed 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, after waiting for a long time, the application cannot get the location. Code is tested on Nokia X7 and 603.
Have someone met this issue before?
Thanks,
-
Try adding "LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData" to the symbian capabilities, those are required capabilities according to the "docs":http://doc.qt.nokia.com/qtmobility-1.2.1/quickstart.html
-
Hi all,
Search for some posts - there is a specific bug in PositionSource which causes your device to look for GPS data and hanging up on it if no GPS signal is received (hence you see GPS icon).
This means outside your code will work fine, but PositionSource won't automatically look for non-GPS sources...Best workaround is to go with Qt C++ and write custom nonGPS PositionSource.
Problem will be again if you rely on GPS more - to code something to manage "blending" different sources...