Code example for Location

Methods: getAccuracygetTime

0
    } 
 
    private void reportLocationFound(Location location) {
        Log.d(TAG, "reportLocationFound");
        if (mMyLocationFoundListener != null) {
            mMyLocationFoundListener.onMyLocationFound(location);
        } 
    } 
 
    /** 
     * Is the provided {@link Location} accepted? 
     * @param location the location 
     * @return <code>true</code> if accepted <code>false</code> otherwise 
     */ 
    public boolean shouldAcceptLocation(Location location) {
        if (location == null)
            return false; 
 
        long timeSinceUpdate = System.currentTimeMillis() - location.getTime();
        if (timeSinceUpdate <= ACCEPTED_LOCATION_AGE_MILLIS 
                && location.getAccuracy() <= ACCEPTED_LOCATION_ACCURACY_METERS) {
            return true; 
        } 
        return false; 
    }