Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Nokia Asha web apps – W3C Geolocation API

From Wiki
Jump to: navigation, search

This article explains how to use W3C Geolocation API in Nokia Asha Web Apps

Article Metadata
Tested with
SDK: Nokia Web Tools 1.5
Devices(s): X3-02
Platform(s): Series 40
Series 40
Keywords: getCurrentPosition
Created: isalento (01 Nov 2011)
Last edited: hamishwillee (09 May 2013)


Nokia Asha Web Apps version 1.5 supports "single-shot" location retrieval in correspondence to W3C Geolocation API . Device location is obtained by using network-based positioning, hence accuracy varies depending on a device features and network configuration in which device is used. Network based positioning offers fast location retrieval even in indoors, making it well suitable for Series 40 web apps.

Unsupported features

Following features specified in W3C Geolocation API are not supported in the Nokia Asha Web Apps version 1.5:

  • Repeated location updates, in other words location tracing is not supported. Hence watchPosition() and clearWatch() methods are not supported either.
  • Position options attribute enableHighAccuracy is not supported.
  • Following attributes of coordinates interface are not supported: altitudeAccuracy, speed and heading .
  • Passing anonymous callback methods to getCurrentPosition()
  • PositionError interface: err.TIMEOUT, err.PERMISSION_DENIED and err.POSITION_UNAVAILABLE are not defined. Instead, use directly numeric values.

Implementation example

function getPosition(){  
navigator.geolocation.getCurrentPosition(geoSuccess, geoFailure);
// geolocation API is not available, handle the case here
function geoSuccess(position){
* handle success here
* use: position.coords.latitude, position.coords.longitude
* position.coords.accuracy and position.timeStamp

function geoFailure(error){
* handle failure here
* use: error.code and error.message

This page was last modified on 9 May 2013, at 10:39.
49 page views in the last 30 days.