March 24, 2012

hoanghua hoanghua
Lab Rat
20 posts

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

  1. import QtQuick 1.1
  2. import QtMobility.location 1.2
  3.  
  4. Rectangle {
  5.     id: page
  6.     width: 350
  7.     height: 350
  8.     PositionSource {
  9.         id: positionSource
  10.         updateInterval: 1000
  11.         active: true
  12.         // nmeaSource: "nmealog.txt"
  13.     }
  14.     Column {
  15.         Text {text: "<==== PositionSource ====>"}
  16.         Text {text: "positioningMethod: "  + printableMethod(positionSource.positioningMethod)}
  17.         Text {text: "nmeaSource: "         + positionSource.nmeaSource}
  18.         Text {text: "updateInterval: "     + positionSource.updateInterval}
  19.         Text {text: "active: "     + positionSource.active}
  20.         Text {text: "<==== Position ====>"}
  21.         Text {text: "latitude: "   + positionSource.position.coordinate.latitude}
  22.         Text {text: "longitude: "   + positionSource.position.coordinate.longitude}
  23.         Text {text: "altitude: "   + positionSource.position.coordinate.altitude}
  24.         Text {text: "speed: " + positionSource.position.speed}
  25.         Text {text: "timestamp: "  + positionSource.position.timestamp}
  26.         Text {text: "altitudeValid: "  + positionSource.position.altitudeValid}
  27.         Text {text: "longitudeValid: "  + positionSource.position.longitudeValid}
  28.         Text {text: "latitudeValid: "  + positionSource.position.latitudeValid}
  29.         Text {text: "speedValid: "     + positionSource.position.speedValid}
  30.     }
  31.     function printableMethod(method) {
  32.         if (method == PositionSource.SatellitePositioningMethod)
  33.             return "Satellite";
  34.         else if (method == PositionSource.NoPositioningMethod)
  35.             return "Not available"
  36.         else if (method == PositionSource.NonSatellitePositioningMethod)
  37.             return "Non-satellite"
  38.         else if (method == PositionSource.AllPositioningMethods)
  39.             return "All/multiple"
  40.         return "source error";
  41.     }
  42. }

untitled.pro

  1. # Add more folders to ship with the application, here
  2. folder_01.source = qml/untitled
  3. folder_01.target = qml
  4. DEPLOYMENTFOLDERS = folder_01
  5.  
  6. # Additional import path used to resolve QML modules in Creator's code model
  7. QML_IMPORT_PATH =
  8.  
  9. symbian:TARGET.UID3 = 0xE5101660
  10.  
  11. # Smart Installer package's UID
  12. # This UID is from the protected range and therefore the package will
  13. # fail to install if self-signed. By default qmake uses the unprotected
  14. # range value if unprotected UID is defined for the application and
  15. # 0x2002CCCF value if protected UID is given to the application
  16. #symbian:DEPLOYMENT.installer_header = 0x2002CCCF
  17.  
  18. # Allow network access on Symbian
  19. symbian:TARGET.CAPABILITY += NetworkServices Location
  20.  
  21. # If your application uses the Qt Mobility libraries, uncomment the following
  22. # lines and add the respective components to the MOBILITY variable.
  23.  CONFIG += mobility
  24.  MOBILITY += location
  25.  
  26. # Speed up launching on MeeGo/Harmattan when using applauncherd daemon
  27. # CONFIG += qdeclarative-boostable
  28.  
  29. # Add dependency to Symbian components
  30. # CONFIG += qt-components
  31.  
  32. # The .cpp file which was generated for your project. Feel free to hack it.
  33. SOURCES += main.cpp
  34.  
  35. # Please do not modify the following two lines. Required for deployment.
  36. include(qmlapplicationviewer/qmlapplicationviewer.pri)
  37. 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,

3 replies

May 5, 2012

yazwas yazwas
Lab Rat
36 posts

Good day

I’m trying exactly the same example and I’m not getting anything, also in the .pro file I’ve added the location capability, but nothing is happening

any suggestions?

Thanks

June 1, 2012

Dickson Dickson
Lab Rat
22 posts

Try adding “LocalServices ReadUserData WriteUserData ReadDeviceData WriteDeviceData” to the symbian capabilities, those are required capabilities according to the docs [doc.qt.nokia.com]

June 2, 2012

cmer4 cmer4
Lab Rat
109 posts

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…

 
  ‹‹ [SOLVED]How can I create TextArea element in desktop application      Which library to install on target? ››

You must log in to post a reply. Not a member yet? Register here!