Motorola Inc.

i88s J2ME Developers’ Guide

delay=high

This option provides a response to the application where delay is longer than a delay=low setting. It provides for an assisted or autonomous fix for the application. The phone uses existing assist data only if it is available and valid; otherwise, the location fix shall proceed autonomously. Currently, maximum response time for this type of request is 128 seconds. If the response times out, position will be returned with the appropriate status and error code.

Retrieving Position in Java

Only one request of getPosition() can be made or be pending at any time. If the application makes multiple requests without getting a response to the previous request, a null position value will be returned or an Exception will be thrown. The next section provides more detail on this method.

1.3.1 Method Descriptions

getPosition()

This method allows an application to obtain position by using the same delay setting used for Connector.open().

getPosition(String name)

This method allows an application to obtain a new position with different delay parameters. This method also allows an application to obtain a fix with an accurate velocity and heading direction. Note that obtaining an accurate velocity and heading direction may cause a significant delay with weak GPS signal strength. In strong GPS signal coverage this operation may take no longer than a standard fix.

The argument required for accurate velocity and heading direction is as follows:

String name = “delay=low;fix=extended”;

// or

String name = “delay=high;fix=extended”;

getPosition() and getPosition(String name) are synchronous, blocking methods which means these methods block until a response, error, or timeout occurs. Closing PositionConnection from a separate thread can unblock these calls. Once the connection is closed, it needs to be opened again using Connector.open().

If the PositionConnection is closed while a getPosition() call is pending or a second call has been made to getPosition(), then getPosition() and getPosition(String name) return a null position. Unknown errors may occur during a location fix, which may also cause null position value to be returned.

requestPending()

This method provides an application with an ability to check for pending position requests on a connection before making a new request from another thread.

Version 1.0 - Page 8

Page 8
Image 8
Motorola i88s manual Method Descriptions, Retrieving Position in Java, GetPositionString name, RequestPending