# ILocation.Trace()

Description:

The `Trace` method retrieves periodic updates about the current location of the device based on a predefined update interval.

This is an asynchronous method.

Syntax:

    result = so.ILocation.Trace(criteria, callback);

Arguments:

- `criteria`:

  This is an object that specifies what type of device location information is returned and how. For more information about the object properties and how to define them, see section Criteria for retrieving location information.

- `callback`:

  The `callback` argument is the name of the method that is executed when `Trace` has results or status information to return. You must define this method separately. Follow the instructions in section Defining the callback handler for an asynchronous method to define the `callback` method.

Return value:

The `Trace` method returns an object that contains the initial return value for the asynchronous call it started (see the following table). The actual location information is returned by the `callback` method in the `ReturnValue` property of its result object. The returned information is described in section Returned location information.

Table: Return value properties for Trace
Property | Description | Value
--- | --- | ---
`result.TransactionID` | This is a number used as an identification to match transactions started with the `Trace` call to one or more calls it generates to `callback`. |
`result.ErrorCode` | This is a number that specifies a predefined error code. | See Service API error codes.
`result.ErrorMessage` | This is a text string that describes the error. | See Location Service API error messages.

Remarks:

- `Trace` retrieves location updates until cancelled with `CancelNotification`. You can therefore have only one `Trace` call (one instance) pending or in use at any given time.

- The availability of specific location information depends on the underlying GPS technology. Other factors, such as the number of satellites available for a location fix, also affect what information can be returned. You can change the positioning system used by an S60 device from the Settings > General > Positioning > Positioning methods menu.

- It takes time to retrieve the initial position fix. Subsequent requests are faster.

Example code:

For the complete source of a sample widget that demonstrates how to use this Service API, see the full example.