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.

Revision as of 06:14, 4 October 2012 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Cancelling an asynchronous function call in Symbian Web Runtime

From Wiki
Jump to: navigation, search

This code snippet demonstrates how to cancel an asynchronous Trace function call of the Location Service API of the Symbian Web Runtime. It is assumed that the location changes are being tracked as described in Tracking changes in the current location in Symbian Web Runtime (with the startTracking() function).

Article Metadata
Tested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: device.getServiceObject(), Service.Location, Service.Location.Trace(), Service.Location.CancelNotification()
Created: User:Nokia Developer KB (17 Nov 2008)
Last edited: hamishwillee (04 Oct 2012)


// Stops the tracking
function stopTracking() {
// The function to be cancelled is Trace
var cancelCriteria = new Object();
cancelCriteria.CancelRequestType = "TraceCancel";
// Send the cancel notification
var result = serviceObj.ILocation.CancelNotification(cancelCriteria);
if (result.ErrorCode != 0) {
alert("Error: " + result.ErrorMessage);
} else {
alert("Tracking stopped.");


The previously called Trace function has been cancelled.

See also

This page was last modified on 4 October 2012, at 06:14.
42 page views in the last 30 days.