Development Guide

Local Navigation

Specifying the GPS mode by using JSR 179

If you use the JSR 179 package, you must specify the properties for the GPS mode in the javax.microedition.location.Criteria class. The application cannot set the GPS mode directly. If a BlackBerry device is paired with a Bluetooth enabled GPS device to determine location, then the Bluetooth enabled device will be used regardless of how the Criteria object has been configured.

Specify the GPS mode (JSR 179)

The JSR 179 Location API is supported on BlackBerry devices that run BlackBerry Device Software 4.0.2 or later.

  1. Import the required class.
    import javax.microedition.location.Criteria;
  2. Create a class and constructor.
    public class handleGPS
    {
        public handleGPS()
        {
        }
    }
  3. In the constructor, create an instance of the Criteria class. Create a variable to specify a GPS mode.
    Criteria myCriteria = new Criteria();
    int myMode = 2; // AUTONOMOUS
  4. In the constructor, map the properties for each GPS mode by invoking the corresponding set method for each property.
    switch ( myMode )
    {
        case 0: // CELLSITE
            myCriteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_LOW);
            myCriteria.setHorizontalAccuracy(Criteria.NO_REQUIREMENT);
            myCriteria.setVerticalAccuracy(Criteria.NO_REQUIREMENT);
            myCriteria.setCostAllowed(true);
            break;
    
        case 1: // ASSIST
            myCriteria.setPreferredPowerConsumption(Criteria.POWER_USAGE_MEDIUM);
            myCriteria.setHorizontalAccuracy(100);
            myCriteria.setVerticalAccuracy(100);
            myCriteria.setCostAllowed(true);
            break;
    
        case 2: // AUTONOMOUS
            myCriteria.setCostAllowed(false);
            break;
    }
Back To Top

Criteria mapping properties

If you use the JSR 179 Location API to specify a GPS mode, you must map the following properties for the Criteria class.

GPS mode

Horizontal accuracy

Vertical accuracy

Cost allowed

Power usage level

Response time

Fix frequency

Autonomous

required

required

no

any

any

single or multiple

Autonomous

not required

not required

no

medium, high, or not required

any

single or multiple

Assisted or data optimal

not required

not required

yes

medium, high, or not required

any

single or multiple

Assisted or speed optimal

required

required

yes

high

quality of service

multiple

Assisted or MS-Based

required

required

yes

medium or not required

quality of service

multiple

Assisted or accuracy optimal

required

required

yes

high

quality of service

single

Assisted or MS-Assisted

required

required

yes

medium or not required

quality of service

single

Cell site

not required

not required

yes

low

any

any

Back To Top
Previous topic: GPS modes

Was this information helpful? Send us your comments.