Cancelling an asynchronous function call in Symbian Web Runtime

From Nokia Developer 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.
46 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.