×
Namespaces

Variants
Actions

Nokia Asha web apps – W3C Geolocation API

From Nokia Developer 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
Compatibility
Platform(s): Series 40
Series 40
Article
Keywords: getCurrentPosition
Created: isalento (01 Nov 2011)
Last edited: hamishwillee (09 May 2013)

Overview

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(){  
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(geoSuccess, geoFailure);
}else{
// 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.
60 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×