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.

Archived:Adding a landmark in Flash Lite

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

This code snippet demonstrates how to track movements and save the location information as a landmark using the Location and Landmarks Platform Services for Flash Lite supported from S60 5th Edition onwards.

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition and later
S60 5th Edition
Keywords: Service.Location, location.Trace(), location.CancelNotification(), Service.Landmarks, landmark.Add()
Created: User:Nokia Developer KB (26 Jan 2009)
Last edited: hamishwillee (13 May 2013)



Note.pngNote: To get the location data the GPS of the device needs to be active. If GPS does not work it is possible to set the information to the input.


// Import Platform Service Interface
// Heading of the application
heading_txt.text = "Adding a landmark";
// Create new Service object which has Location information
var location = new Service("Service.Location", "ILocation");
// Create new Service object which has Landmark information
var landmark = new Service("Service.Landmarks", "IDataSource");
** Function for pressing the Track button.
** Calls Trace() method asynchronously.
** Traces location information to the text field.

track_mc.onPress = function() {
error_txt.text = "Waiting for GPS";
// Disable button because an asynchronous method cannot be called twice
track_mc.enabled = false;
// Define input parameters
// 1000000 microseconds = 1 second (update interval)
var updateOptions = {UpdateInterval:1000000};
var inParams = {LocationInformationClass:"GenericLocationInfo",
// Call Trace() as an asynchronous method
// Define callback function
function onNotify (transactionID:Number, eventID:String, outParam:Object) {
if (outParam.ErrorCode == 0) {
var outList = outParam.ReturnValue;
var longitude = outList.Longitude;// Contains longitudinal data
var latitude = outList.Latitude;// Contains latitudinal data
longitude_txt.text = longitude
latitude_txt.text = latitude;
} else {
var errorId = outParam.ErrorCode;
error_txt.text = "Error while tracking: "+errorId;
** Function for pressing the Stop button.
** Calls CancelNotification() method synchronously.
** Method cancels the Trace method

stop_mc.onPress = function() {
// Define input parameters
var inParams = {CancelRequestType:"TraceCancel"};
// Define result value
var outParams = location.CancelNotification(inParams);
if (outParams.ErrorCode == 0) {
error_txt.text = "Trace stopped."
} else {
var errorId2 = outParams.ErrorCode;
error_txt.text = "Error while stopping: "+errorId2;
// Enable Track button
track_mc.enabled = true;
** Function for pressing the Add button.
** Calls Add() method synchronously.
** Adds a new landmark with name and position information.

add_mc.onPress = function() {
// Get info from the inputs
var landmarkName = landmark_txt.text;
var lon = longitude_txt.text;
var lat = latitude_txt.text;
var longitude = Number(lon);
var latitude = Number(lat);
// Define landmark information
var landmarkPosition = {Longitude:longitude, Latitude:latitude};
var landmarkInfo = {LandmarkName:landmarkName,
// Define input parameters
var inParams = {Type:"Landmark", Data:landmarkInfo};
// Define result value
var outParams = landmark.Add(inParams);
if (outParams.ErrorCode == 0) {
var landmarkId = outParams.ReturnValue;
error_txt.text = "ID"+landmarkId+" added";
else {
var errorId3 = outParams.ErrorCode;
error_txt.text = "Error while adding: "+errorId3;


When the Track button is pressed, longitude and latitude information of the device are displayed as inputs. Location information on the screen changes when the device moves. Tracking can be stopped by pressing the Stop button. You can add a landmark by pressing the Add button when Landmark, longitude, and latitude inputs have data.

Example application

The following sample application has been tested in the Nokia 5800 XpressMusic (S60 5th Edition, Flash Lite 3.0): File:FlashLite Adding A

See also

This page was last modified on 13 May 2013, at 06:33.
75 page views in the last 30 days.