Retrieve GPS information during a call

You can permit a BlackBerry® device application to obtain GPS information while a BlackBerry device user is on a phone call.

  1. Import the following classes:
    • javax.microedition.location.LocationProvider
    • javax.microedition.location.Criteria
  2. Create an instance of the Criteria class.
    Criteria criteria = new Criteria();
    
  3. Configure the Criteria object to obtain GPS information without using a wireless network.
  4. Invoke Criteria.setCostAllowed() using the Boolean value of false as a parameter to configure that a BlackBerry device cannot incur any costs.
    criteria.setCostAllowed(false);
    
  5. Invoke the LocationProvider.getInstance() method using a Criteria object as a parameter that you configure to obtain GPS information without using a wireless network. Assign the value that the method returns to a LocationProvider variable.
    LocationProvider provider = LocationProvider.getInstance(criteria);
    

Was this information helpful? Send us your comments.