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

This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude
     
    public Location getHomeLocation() {
    	if(!settings.getBoolean("haveHomeLocation", false))
    		return null; 
    	 
    	Location loc = new Location("Home");
    	loc.setLatitude(settings.getFloat("HomeLocLat", (float)40.443181));  // Easter Egg: default value
    	loc.setLongitude(settings.getFloat("HomeLocLong", (float)-79.943060));
    	loc.setAccuracy(settings.getFloat("HomeLocAccuracy", 100000));
    	return loc;
    } 
     
    // Higher level settings 
    public int getClientID() { return settings.getInt("randClientID",-1); }
    public void setClientID(int id) { sEditor.putInt("randClientID", id); sEditor.commit(); }
    public String getHomeSSID() { return settings.getString("homeSSID", null); }
    public void setHomeSSID(String ssid) { sEditor.putString("homeSSID", ssid); sEditor.commit(); }
     
    // For some 802.11 wireless settings 
    public int getHomeWifiFreq() { return settings.getInt("homeWifiFreq", -1); }
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude, setTime
			} 
		} 
    	 
    	private void setLocation(LocationManager locationManager, String locationProvider, double latitude, double longitude) {
 
    		Location location = new Location(locationProvider);
    		location.setLatitude(latitude);
    		location.setLongitude(longitude);
    		location.setAccuracy(1);
    		location.setTime(System.currentTimeMillis());
 
            try { 
                Method makeComplete = Location.class.getMethod("makeComplete");
                if (makeComplete != null) {
                    makeComplete.invoke(location);
                } 
            } catch (Exception e) {
                //Method only available in Jelly Bean 
            } 
 
8
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude
                            "supportsSpeed" == "", 
                            "supportsBearing" == "", 
                             android.location.Criteria.POWER_LOW,
                             android.location.Criteria.ACCURACY_FINE);      
 
        Location newLocation = new Location(LocationManager.GPS_PROVIDER);
 
        newLocation.setLatitude(latitude);
        newLocation.setLongitude(longitude);
        newLocation.setAccuracy(accuracy);
 
        lm.setTestProviderEnabled(LocationManager.GPS_PROVIDER, true);
 
        lm.setTestProviderStatus(LocationManager.GPS_PROVIDER,
                                 LocationProvider.AVAILABLE,
                                 null,System.currentTimeMillis());    
       
        lm.setTestProviderLocation(LocationManager.GPS_PROVIDER, newLocation);      
 
    } 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setTime
    private Location getLastBestLocation() {
        return lastLocationFinder.getLastBestLocation(MIN_TIME);
    } 
 
    private Location addLocationToManager(long timestamp, float accuracy, String provider) {
        Location location = new Location(provider);
        location.setTime(timestamp);
        location.setAccuracy(accuracy);
        providers.add(provider);
        when(locationManager.getLastKnownLocation(provider)).thenReturn(location);
        return location;
    } 
 
    @Test 
    public void find_an_invalid_location_if_no_location_is_available() throws Exception { 
        providers.add(PROVIDER_ONE);
        when(locationManager.getLastKnownLocation(PROVIDER_ONE)).thenReturn(INVALID_LOCATION);
        Location lastBestLocation = getLastBestLocation();
        assertThat(lastBestLocation, is(INVALID_LOCATION));
    } 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude, setTime
		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 
	public String getProvider() {
		return location.getProvider();
		 
	}	 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setLatitude, setLongitude, setTime
  SQLiteDatabase myDb;
  TrackMeDB db;
  MyPreference myPreference;
 
  public static Location mkLocation(Double lat, Double lng, long alt, long acc, long ts) {
    Location l = new Location("");
    l.setLatitude(lat);
    l.setLongitude(lng);
    l.setAltitude(alt);
    l.setAccuracy(acc);
    l.setTime(ts);
    return l;
  } 
 
  public static Location mkLocationWithoutAltitude(Double lat, Double lng, long acc, long ts) {
    Location l = new Location("");
    l.setLatitude(lat);
    l.setLongitude(lng);
    l.setAccuracy(acc);
    l.setTime(ts);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude
	    return false; 
	} 
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home_location); 
                
        debugOut("Entering the creation of the Home Location activity"); 
         
        // Initialize a few local variables 
        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        _settings = new UserSettings(this);
        _handler = new Handler();
        _locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
 
        // Try to get the location of the user's home, if it is set we zoom 
        // in on it and then we return. 
        if(setHomeLocationIfKnown()) 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude, setTime
This code example shows how to use the following methods:setAccuracy, setLatitude, setLongitude, setTime
	 
	/* 
	 * Get the trigger location 
	 */ 
	public Location getTriggerLocation() {
		Location loc = new Location(mTrigLocProvider);
		 
		loc.setLatitude(mTrigLocLat);
		loc.setLongitude(mTrigLocLong);
		loc.setAccuracy(mTrigLocAccuracy);
		loc.setTime(mTrigLocTime);
		 
		return loc;
	} 
	 
	/* 
	 * Set the trigger location  
	 */ 
	public void setTriggerLocation(Location loc) {
		if(loc == null) {
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setExtras, setLatitude
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Location setAccuracy Questions & Answers:

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