×
Namespaces

Variants
Actions
Revision as of 09: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 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
Compatibility
Platform(s): S60 5th Edition
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.
59 page views in the last 30 days.