Namespaces
Variants
Actions

Cancelling an asynchronous function call in Symbian Web Runtime

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

Compatibility
Platform(s): S60 5th Edition

Article
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)

Source

// 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.");
}
}

Postconditions

The previously called Trace function has been cancelled.

See also

This page was last modified on 4 October 2012, at 09:14.
153 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved