Location hasAccuracy - 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 hasAccuracy method.

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
This code example shows how to use the following methods:hasAccuracy
        tPaint.setColor(Color.WHITE);
    } 
	 
	public void updateGeoData(float[] data, Location location) {
		this.mValues = data;
		if(location.hasAccuracy())
			this.mLocation = location;
		invalidate();
	} 
     
    @Override protected void onDraw(Canvas canvas) {
    	canvas.translate(30, 30);
        if (mValues != null)
        	if(mLocation != null && location != null) {
        		float angle =-mValues[0]+mLocation.bearingTo(location);  
    			canvas.rotate(angle);
                canvas.drawPath(mPath, mPaint);
                canvas.rotate(-angle);
        	} 
        canvas.drawText(getDistance(), 0, 0, tPaint);
7
CodeRank
This code example shows how to use the following methods:hasAccuracy
		return location.getTime();
	} 
 
	@Override 
	public boolean hasAccuracy() { 
		return location.hasAccuracy();
	} 
	 
	private static Location createFromGeneric(GenericLocation g)
	{ 
		Location l = new Location(g.getProvider());
		l.setAccuracy(g.getAccuracy());
		l.setLatitude(g.getLatitude());
		l.setLongitude(g.getLongitude());
		l.setTime(g.getTime());
			 
		return l;
	} 
 
	@Override 
7
CodeRank
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
This code example shows how to use the following methods:getAccuracy, hasAccuracy
    * filter those out. 
    *  
    * @param proposedLocation 
    * @return if the location is accurate enough 
    */ 
   public boolean isLocationAcceptable( Location proposedLocation )
   { 
      boolean acceptable = true; 
      if( previousLocation != null && proposedLocation.hasAccuracy() )
      { 
         acceptable = proposedLocation.getAccuracy() < this.mAcceptableAccuracy 
                        && proposedLocation.getAccuracy() < previousLocation.distanceTo( proposedLocation ) ;
      } 
      return acceptable;
   } 
 
   /** 
    * Trigged by events that start a new track 
    */ 
   private void startNewTrack()  
8
CodeRank
This code example shows how to use the following methods:hasAccuracy, hasAltitude, hasBearing, hasSpeed
    public void logWithoutUpdate() { 
        makeEntry(); 
    } 
 
    public void logAdvancedFeatureStatus(Location location) {
        Log.i(_tag, "Accuracy  : " + location.hasAccuracy());
        Log.i(_tag, "Altitude  : " + location.hasAltitude());
        Log.i(_tag, "Bearing   : " + location.hasBearing());
        Log.i(_tag, "Speed     : " + location.hasSpeed());
 
    } 
 
    protected void makeEntry() { 
        Log.i(_tag, "Provider  : " + _location.getProvider());
        Log.i(_tag, "Latitude  : " + _location.getLatitude());
        Log.i(_tag, "Longitude : " + _location.getLongitude());
        Log.i(_tag, "Accuracy  : " + _location.getAccuracy());
        Log.i(_tag, "Altitude  : " + _location.getAltitude());
        Log.i(_tag, "Bearing   : " + _location.getBearing());
        Log.i(_tag, "Speed     : " + _location.getSpeed());
8
CodeRank
This code example shows how to use the following methods:bearingTo, distanceTo, getAltitude, hasAccuracy
6
CodeRank
This code example shows how to use the following methods:getAccuracy, hasAccuracy
		locationManager.removeUpdates(listener);
		throw new NoProvidersException(); 
	} 
	 
	public static boolean isAccurateEnoughForNearbyRoutes(Location location) {
		return location.hasAccuracy() && location.getAccuracy() < NEAR_BY_RADIUS;
	} 
	 
	public static boolean locationIsSignificantlyDifferentToCurrentLocationToWarrentReloadingResults(Location currentLocation, Location newLocation) {
		if (currentLocation == null) {
			return true; 
		} 
		float distanceBetween = DistanceMeasuringService.distanceBetween(currentLocation, newLocation);
		final boolean isSignificant = distanceBetween > (NEAR_BY_RADIUS / 2) && distanceBetween > newLocation.getAccuracy();
		Log.d(TAG, "Distance from last location: " + distanceBetween + " (is significant: " + isSignificant + ")");
		return isSignificant;
	} 
	 
	public static void turnOffLocationUpdates(Context context, LocationListener listener) {
		Log.d(TAG, "Turning off location updates");
8
CodeRank
This code example shows how to use the following methods:getAccuracy, getLatitude, getLongitude, getTime, hasAccuracy
            acc = p.acc;
        } 
 
        @SuppressWarnings("unused") 
        public PositionPoint(Location p) {
            timestamp = p.getTime();
            lat = p.getLatitude();
            lon = p.getLongitude();
            if (p.hasAccuracy())
                acc = p.getAccuracy();
        } 
 
        /* 
         * Note, equals and hashCode ignore the timestamp as that one is irrelevant for the 
         * medianFilter. A bit ugly but hey, it's a private class 
         */ 
        @Override 
        public boolean equals(Object obj) {
            if (obj instanceof PositionPoint) {
                PositionPoint pp = (PositionPoint) obj;
7
CodeRank
This code example shows how to use the following methods:getAccuracy, getLatitude, getLongitude, hasAccuracy
     */ 
    LocationListener locationListenerGps = new LocationListener() {
        public void onLocationChanged(Location loc) { 
            if (DEBUG) Log.d(TAG, "GPS location listener being utilized"); 
            if ((location.getProvider().equals(DEFAULT_PROVIDER)) || (!location.hasAccuracy())) { 
                location = loc; 
                // send location update broadcast 
                Intent intent = new Intent(); 
                intent.setAction(LOCATION_UPDATE_INTENT); 
                intent.putExtra("latitude", loc.getLatitude()); 
                intent.putExtra("longitude", loc.getLongitude()); 
                sendBroadcast(intent); 
            } 
            else if	((loc.hasAccuracy() && (loc.getAccuracy() < location.getAccuracy())) || 
                    ((location.distanceTo(loc) > MAX_DISTANCE_METERS)) 
                            && (loc.hasAccuracy()) 
                            && (loc.getAccuracy() < location.distanceTo(loc))) { 
                location = loc; 
                // send location update broadcast 
                Intent intent = new Intent(); 

6
CodeRank

Related Location hasAccuracy Questions & Answers:

hasAccuracy Method Overview
True if this location has an accuracy.
See Code Examples for other Android Location Methods: