Location getAccuracy - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Location getAccuracy method.

This code example shows how to use the following methods:getAccuracy
		 
	} 
	 
	private boolean isAccurate(Location loc){
		 
		return loc.getAccuracy() < accuracy;
		 
	} 
	 
	 
	private boolean isDiff(Location loc){
 
		if(result == null) return true; 
		 
		float diff = distFrom(result.getLatitude(), result.getLongitude(), loc.getLatitude(), loc.getLongitude());
		 
		if(diff < tolerance){
			AQUtility.debug("duplicate location"); 
			return false; 
		}else{ 
10
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, getLatitude, getLongitude
	} 
 
	 
	public void onLocationChanged(Location loc) {
		this.location=loc;
		Log.i(LOG_TAG, "location update "+loc.getLatitude()+" : "+loc.getLongitude()+" : "+loc.getAccuracy());
	} 
	 
	public void onActivityResult(int requestCode, int resultCode, Intent intent) {
		Log.i(LOG_TAG, "onActivityResult(" + requestCode + "," + resultCode +  ")");
	    if (requestCode == 99) {
	        if (resultCode == RESULT_OK) {
	            String contents = intent.getStringExtra("SCAN_RESULT");
	            String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
        		Log.i(LOG_TAG, "scanned(" + contents + "," + format +  ")");
        		if("QR_CODE".equals(format) && contents.startsWith("http://partybolle.appspot.com/qr/")){
        			//checken im hintergrund und dann updaten 
        			uffjabenManager.checkUffjabe(preferences.getString("twitter_name_verified",null), challengeId, contents.substring(33),location);
        		}else{ 
					AlertDialog.Builder builder = new AlertDialog.Builder(this);
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy
            return false; 
        } 
        // min. 100m accuracy und gps daten nicht älter als 2 min 
//        Date locationDate = new Date(location.getTime()); 
//        locationDate = DateUtils.addMinutes(locationDate, 2); 
        return location.getAccuracy() <= 100 && isGpsEnabled();
//                && locationDate.after(new Date()); 
    } 
 
    public boolean isGpsEnabled() { 
        return locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
    } 
 
    public boolean isQualityAcceptableForReading() { 
        return getCurrentLocation() != null && isGpsEnabled(); 
    } 
 
} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, hasAccuracy
    		} 
	    } 
	} 
	 
	private boolean isAccurate(Location location) {
	    return !location.hasAccuracy() || location.getAccuracy() < 600;
	} 
 
	private boolean shouldUpdate(Location location) {
		boolean isAccurate;
		long elapsedMillis;
 
		// If the last update was null, use the current point 
		if (lastUpdate == null)
			return true; 
 
		elapsedMillis = System.currentTimeMillis() - lastUpdate.getTime();
		 
		// If not enough time has elapsed since the last point received, don't use this point 
		if(elapsedMillis < Util.getMinTime(this))
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy
    public int processLocation(Location location) {
        mDistanceToCenter = mLocation.distanceTo(location);
 
        int prevState = mState;
        //TODO: inside/outside detection could be made more rigorous 
        boolean inside = mDistanceToCenter <= Math.max(mFence.getRadius(), location.getAccuracy());
        if (inside) {
            mState = STATE_INSIDE;
            if (prevState != STATE_INSIDE) {
                return FLAG_ENTER; // return enter if previously exited or unknown
            } 
        } else { 
            mState = STATE_OUTSIDE;
            if (prevState == STATE_INSIDE) {
                return FLAG_EXIT; // return exit only if previously entered
            } 
        } 
        return 0; 
    } 
 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:distanceTo, getAccuracy, getLatitude, getLongitude, getProvider
      Log.wtf(getClass().getSimpleName(),
              "Got null for getBestLocation()"); 
    } 
    else { 
      Log.i(getClass().getSimpleName(),
            String.format("%s %f:%f (%f meters)", loc.getProvider(),
                          loc.getLatitude(), loc.getLongitude(),
                          loc.getAccuracy()));
    } 
  } 
 
  private Location getBestLocation() {
    Location gps=mgr.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    Location network=
        mgr.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
 
    // start off by handling cases where we only have one 
 
    if (gps == null) {
      return(network);

9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, getBearing
	@Override 
	protected void drawMyLocation(Canvas canvas, MapView mapView,
			Location lastFix, GeoPoint myLocation, long when) {
		if (isMyLocationEnabled()) { 
			Projection p = mapView.getProjection();
			float accuracy = p.metersToEquatorPixels(lastFix.getAccuracy());
			Point currLoc = p.toPixels(myLocation, null);
			float orientation = lastFix.getBearing() - 45;
					 
			if (accuracy > 10.0f) {
				canvas.drawCircle(currLoc.x, currLoc.y, accuracy, strokePaint);
				canvas.drawCircle(currLoc.x, currLoc.y, accuracy, accuracyPaint);
			} 
			 
			rotate.reset();
			rotate.postRotate(orientation, marker.getWidth() / 2, marker.getHeight() / 2);
			Bitmap rotatedMarker = Bitmap.createBitmap(marker, 0, 0, marker.getWidth(), marker.getHeight(), rotate, true);
			canvas.drawBitmap(rotatedMarker, currLoc.x - (marker.getWidth() / 2), currLoc.y - (marker.getHeight() / 2), null);
			canvas.restore();
		} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy
 
		// Draw accuracy before marker 
		if (mIsAccuracyEnabled) {
			// Get the proportional accuracy radius based on the visible map 
			int radius = (int) mapView.getProjection().metersToEquatorPixels(
					lastFix.getAccuracy());
			// Draw the color 
			canvas.drawCircle(pointOnScreen.x, pointOnScreen.y, radius,
					mAccuracyFillPaint);
			// Draw the stroke 
			canvas.drawCircle(pointOnScreen.x, pointOnScreen.y, radius,
					mAccuracyStrokePaint);
		} 
 
		// Draw the marker on canvas 
		canvas.drawBitmap(mBitmap, matrix, mMarkerPaint);
 
		// Invalidate the MapView 
		mapView.postInvalidate();
	} 
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, hasAccuracy
    * @return if the location is accurate enough 
    */ 
   public boolean isLocationAcceptable( Location proposedLocation )
   { 
      boolean acceptable = true; 
      if( previousLocation != null && proposedLocation.hasAccuracy() )
      { 
         //Log.d(this.getClass().getCanonicalName(), "Distance traveled is: "+lastLocation.distanceTo( proposedLocation )); 
         //Log.d(this.getClass().getCanonicalName(), "Accuratcy is: "+proposedLocation.getAccuracy() ); 
         acceptable = proposedLocation.getAccuracy() < previousLocation.distanceTo( proposedLocation ) ;
      } 
      return acceptable;
   } 
 
   /** 
    * Trigged by events that start a new track 
    */ 
   private void startNewTrack()  
   { 
      Uri newTrack = this.mContext.getContentResolver().insert( Tracks.CONTENT_URI, null );
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, getProvider, getTime
			// A new location is always better than no location 
			return true; 
		} 
 
		// Check whether the new location fix is newer or older 
		long timeDelta = location.getTime() - currentBestLocation.getTime();
		boolean isSignificantlyNewer = timeDelta > TWO_MINUTES;
		boolean isSignificantlyOlder = timeDelta < -TWO_MINUTES;
		boolean isNewer = timeDelta > 0;
 
		// If it's been more than two minutes since the current location, use the new location 
		// because the user has likely moved 
		if (isSignificantlyNewer) {
			return true; 
			// If the new location is more than two minutes older, it must be worse 
		} else if (isSignificantlyOlder) {
			return false; 
		} 
 
		// Check whether the new location fix is more or less accurate 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Location getAccuracy Questions & Answers:

getAccuracy Method Overview
Get the estimated accuracy of this location, in meters.
See Code Examples for other Android Location Methods: