Motorola i88s manual Method Descriptions, Retrieving Position in Java, GetPosition, RequestPending

Page 8

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

Image 8
Contents I88s Multi-Communication Device J2ME Developers’ Guide J2ME Networking Document Overview DisclaimerAcronyms Used In This Guide Terminology Definition Contact InformationAcronyms and Definitions Agps On The i88s Phone OverviewAssist Data Position APIAccuracy Example PositionConnection ClassAlmanac Out Of Date Method Descriptions Retrieving Position in JavaGetPosition GetPositionString nameUsing Position in Java GetStatusExample Using PositionConnection Positionresponsenoalmanacoverride Addition, to obtain better accurate speed and direction Recommendation J2ME Networking Http HttpsClass Descriptions Supported Protocols on the i88s Phone HttpHttps ServerSockets TCP SocketsSSL Secure Sockets Serial Port Access UDP SocketsConnection Optional Parameters Communicating on a PortExample using StreamConnection Implementation NotesTips Concurrent Connections For The i88s Phone Protocol MaximumMethod Descriptions Opening a file File I/OClass Description Code Examples Deleting a fileReading and Writing Example # 2 Complete MIDlet code Motorola Inc I88s J2ME Developers’ Guide Os = sc.openOutputStream //get InputStream Sc.close Caveats Motorola Inc I88s J2ME Developers’ Guide
Related manuals
Manual 43 pages 17.94 Kb