Package net.rim.device.api.gps

Examples of net.rim.device.api.gps.BlackBerryCriteria


    //numTries is the number of tries to ge tthe location. once it reaches 0 we have to fail
    private BlackBerryLocation getGeolocation(int numTries){
      if (numTries == 0) return null;
     
      //get current location
        BlackBerryCriteria myCriteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
        BlackBerryLocation myLocation = null;
        try {
      BlackBerryLocationProvider myProvider = (BlackBerryLocationProvider)
      LocationProvider.getInstance(myCriteria);
      myLocation = (BlackBerryLocation)myProvider.getLocation(-1);
View Full Code Here


   * @param mode  One of MODE_OPTIMAL, MODE_GPS, MODE_GEOLOCATION, MODE_GEOLOCATION_CELL, MODE_GEOLOCATION_WLAN
   * @return
   */
  private BlackBerryCriteria setupCriteria(){   
    if(mode==SimpleLocationProvider.MODE_GPS){     
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      criteria.setSatelliteInfoRequired(true, false);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      return criteria;
    }
   

    else if(mode==MODE_GEOLOCATION){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
      log("Criteria set for GPS_MODE_CELLSITE");
      return criteria;
    } else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
      log("Criteria set for GPS_MODE_CELLSITE");
      return criteria;
    } else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      criteria.setSatelliteInfoRequired(true, false);
      return criteria;
    }

View Full Code Here

   * @param mode  One of MODE_OPTIMAL, MODE_GPS, MODE_GEOLOCATION, MODE_GEOLOCATION_CELL, MODE_GEOLOCATION_WLAN
   * @return
   */
  private BlackBerryCriteria setupCriteria(){   
    if(mode==SimpleLocationProvider.MODE_GPS){     
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      criteria.setSatelliteInfoRequired(true, false);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      return criteria;
    }
   
    //#ifdef BlackBerrySDK5.0.0
    else if(mode==MODE_GEOLOCATION){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
      log("Criteria set for GPS_MODE_CELLSITE");
      return criteria;
    } else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
      log("Criteria set for GPS_MODE_CELLSITE");
      return criteria;
    } else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      criteria.setSatelliteInfoRequired(true, false);
      return criteria;
    }
    //#endif
   
    //#ifdef BlackBerrySDK6.0.0
    else if(mode==MODE_GEOLOCATION){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
      log("Criteria set for GEOLOCATION_MODE");
      return criteria;
    } else if(mode==MODE_GEOLOCATION_CELL){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE_CELL);
      log("Criteria set for GEOLOCATION_MODE_CELL");
      return criteria;
    } else if(mode==MODE_GEOLOCATION_WLAN){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE_WLAN);
      log("Criteria set for GEOLOCATION_MODE_WLAN");
      return criteria;
    } else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
      log("Criteria set for GEOLOCATION_MODE");
      return criteria;
    } else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      criteria.setSatelliteInfoRequired(true, false);
      return criteria;
    }   
    //#endif
View Full Code Here

   * Initializes an appropriate Criteria object based on the selected mode. 
   * @param mode  One of MODE_OPTIMAL, MODE_GPS, MODE_GEOLOCATION, MODE_GEOLOCATION_CELL, MODE_GEOLOCATION_WLAN
   */
  private void setupCriteria(){   
    if(mode==SimpleLocationProvider.MODE_GPS){     
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      criteria.setSatelliteInfoRequired(true, false);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
    }
   
    //#ifdef BlackBerrySDK5.0.0
    else if(mode==MODE_GEOLOCATION){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
      log("Criteria set for GPS_MODE_CELLSITE");
    } else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_CELLSITE);
      log("Criteria set for GPS_MODE_CELLSITE");
    } else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      criteria.setSatelliteInfoRequired(true, false);
    }
    //#endif
   
    //#ifdef BlackBerrySDK6.0.0
    else if(mode==MODE_GEOLOCATION){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
      log("Criteria set for GEOLOCATION_MODE");
    } else if(mode==MODE_GEOLOCATION_CELL){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE_CELL);
      log("Criteria set for GEOLOCATION_MODE_CELL");
    } else if(mode==MODE_GEOLOCATION_WLAN){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE_WLAN);
      log("Criteria set for GEOLOCATION_MODE_WLAN");
    } else if(mode==MODE_OPTIMAL && currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
      log("Criteria set for GEOLOCATION_MODE");
    } else if(mode==MODE_OPTIMAL && !currentOptimalModeIsGeolocation){
      criteria = new BlackBerryCriteria(GPSInfo.GPS_MODE_AUTONOMOUS);
      log("Criteria set for GPS_MODE_AUTONOMOUS");
      criteria.setSatelliteInfoRequired(true, false);
    }   
    //#endif
  }
View Full Code Here

         * -else if single fix requested, -if powerUsage = HIGH, mode is
         * Accuracy Optimal -if powerUsage != HIGH, mode is PDE Calculate -if
         * powerUsage = LOW mode is Cellsite
         */
        private void setupCriteria() {
            _bbCriteria = new BlackBerryCriteria();
            _bbCriteria.setPreferredResponseTime(Integer
                    .parseInt(_preferredResponseTimeField.getText()));

            if (_enableConcurrentGeolocationField.getChecked()) {
                _bbCriteria
                        .enableGeolocationWithGPS(BlackBerryCriteria.FASTEST_FIX_PREFERRED);
            } else if (_enableGeolocationFallbackField.getChecked()) {
                _bbCriteria.enableGeolocationWithGPS();
            }

            switch (_primaryModeField.getSelectedIndex()) {
            case 0: // Stand Alone(s)
                _isMultipleFixes = false;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_AUTONOMOUS);
                log("Primary mode set to Stand Alone");
                break;
            case 1: // Stand Alone(m)
                _isMultipleFixes = true;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_AUTONOMOUS);
                log("Primary mode set to Stand Alone");
                break;
            case 2: // Data Optimal(m)
                _isMultipleFixes = true;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CDMA_DATA_OPTIMAL);
                log("Primary mode set to Data Optimal");
                break;
            case 3: // Speed Optimal(m)
                _isMultipleFixes = true;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CDMA_SPEED_OPTIMAL);
                log("Primary mode set to Speed Optimal");
                break;
            case 4: // MS-Based(m)
                _isMultipleFixes = true;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CDMA_MS_BASED);
                log("Primary mode set to MS-Based");
                break;
            case 5: // Accuracy Optimal(s)
                _isMultipleFixes = false;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CDMA_ACCURACY_OPTIMAL);
                log("Primary mode set to Accuracy Optimal");
                break;
            case 6: // PDE Calculate(s)
                _isMultipleFixes = false;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CDMA_MS_ASSIST);
                log("Primary mode set to PDE Calculate");
                break;
            case 7: // Cellsite(s)
                _isMultipleFixes = false;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CELLSITE);
                log("Primary mode set to Cellsite(s)");
                break;
            case 8: // Cellsite(m)
                _isMultipleFixes = true;
                _bbCriteria.setMode(GPSInfo.GPS_MODE_CELLSITE);
                log("Primary mode set to Cellsite(m)");
                break;
            case 9: // Default(s)
                _isMultipleFixes = false;
                log("Primary mode set to Default(m)");
                break;
            case 10: // Default(m)
                _isMultipleFixes = true;
                log("Primary mode set to Default(m)");
                break;
            case 11: // Optimal Geolocation(s)
                _isMultipleFixes = false;
                _bbCriteria =
                        new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
                break;
            case 12: // Optimal Geolocation(m)
                _isMultipleFixes = true;
                _bbCriteria =
                        new BlackBerryCriteria(LocationInfo.GEOLOCATION_MODE);
                break;
            case 13: // Cell Geolocation(s)
                _isMultipleFixes = false;
                _bbCriteria =
                        new BlackBerryCriteria(
                                LocationInfo.GEOLOCATION_MODE_CELL);
                break;
            case 14: // Cell Geolocation(m)
                _isMultipleFixes = true;
                _bbCriteria =
                        new BlackBerryCriteria(
                                LocationInfo.GEOLOCATION_MODE_CELL);
                break;
            case 15: // WLAN Geolocation(s)
                _isMultipleFixes = false;
                _bbCriteria =
                        new BlackBerryCriteria(
                                LocationInfo.GEOLOCATION_MODE_WLAN);
                break;
            case 16: // WLAN Geolocation(m)
                _isMultipleFixes = true;
                _bbCriteria =
                        new BlackBerryCriteria(
                                LocationInfo.GEOLOCATION_MODE_WLAN);
                break;
            }

            if (_failOverModeField.getSelectedIndex() < 6) {
View Full Code Here

            final Thread resetThread = new Thread() {
                /**
                 * @see java.lang.Thread#run()
                 */
                public void run() {
                    final BlackBerryCriteria oldBBCriteria = _bbCriteria;
                    _bbCriteria.setMode(GPSInfo.GPS_MODE_CDMA_MS_ASSIST);
                    LocationProvider tempProvider = null;

                    try {
                        tempProvider =
View Full Code Here

     * then the GeomagneticField will be initialized. Otherwise, the declination
     * will be NaN.
     */
    public void getLocation() {
        try {
            final BlackBerryCriteria criteria = new BlackBerryCriteria();
            criteria.enableGeolocationWithGPS();

            _locationInfo.setText("Searching for location...");
            final BlackBerryLocationProvider bbProvider =
                    (BlackBerryLocationProvider) LocationProvider
                            .getInstance(criteria);
View Full Code Here

TOP

Related Classes of net.rim.device.api.gps.BlackBerryCriteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.