Motorola Inc. | i88s J2ME Developers’ Guide |
com.motorola.iden.position.PositionConnection.POSITION_RESPONSE_RESTRICTED)
{
// means user has restricted permission to get position
}
else if(c.getStatus() == com.motorola.iden.position.PositionConnection.
POSITION_RESPONSE_NO_ALMANAC_OVERRIDE)
{
//means device has Almanac out of date and User has not granted to
override
}
else if(c.getStatus() == com.motorola.iden.position.PositionConnection. POSITION_NO_RESPONSE)
{
//means no response from device
}
if (oap != null ) { if(c.getStatus() ==
com.motorola.iden.position.PositionConnection.POSITION_RESPONSE_OK)
{
//Good position
//Check for any error from device on position
//Application needs to check for null position if(oap.getResponseCode() == PositionDevice.POSITION_OK) {
//no error in the position if(oap.hasLatLon()) {
//int value of Latitude and Longitude of the position in arc
//minutes multiplied by 100,000 to maintain accuracy or
//UNAVAILABLE if not available
int lat = oap.getLatitude(); int lon = oap.getLongitude();
//String representation of the Latitude and Longitude. String LATDEGREES = oap.getLatitude(Position2D.DEGREES); String LONGDEGREES = oap.getLongitude(Position2D.DEGREES);
}
if(oap.hasSpeedUncertainty()) {
//speed and heading value are valid int speed = oap.getSpeed();
if (hasTravelDirection()) {
// heading is available
int travelDirection = oap.getTravelDirection();
}
}
if(oap.hasAltitudeUncertainty()) {
int alt = oap.getAltitude(); //altitude of position in meters.
}
}
//handle the errors…or request again for good position
//or display message to the user.
else if(oap.getResponseCode() == PositionDevice.ACCURACY_NOT_ATTAINABLE) {
//the position information was provided but enough accuracy
//may not be attainable
}
else if(oap.getResponseCode() == PositionDevice.ACC_NOT_ATTAIN_ASSIST_DATA_UNAV) {
// the position information was provided but enough accuracy
Version 1.0 - Page 11