Android LocationRequest - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android LocationRequest class.

This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
	public void onCreate(Bundle savedInstanceState) {
		// NearmeMapFragment onCreate method stub 
		super.onCreate(savedInstanceState);
		mLocationClient = new LocationClient(getActivity(), this, this);
		request = LocationRequest.create();
		request.setInterval(LOCATION_INTERVAL);
		request.setFastestInterval(LOCATION_FASTEST_INTERVAL);
		request.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
 
	} 
 
	@Override 
	public void onStart() { 
		// NearmeMapFragment onStart method stub 
		super.onStart(); 
		mLocationClient.connect();
		 
	} 
 
	@Override 
5
CodeRank
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
 
	@Override 
	public void onCreate() { 
		super.onCreate(); 
		lr = LocationRequest.create();
		lr.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
		lr.setInterval(UPDATE_INTERVAL);
		lr.setFastestInterval(FASTEST_INTERVAL);
		pm = new PreferencesManager(this);
		lc = new LocationClient(this, this, this);
		updates = pm.getBoolean("autotrack");
		// h = new Helper(this); 
	} 
 
	public Location getCurrentLocation() {
		l = lc.getLastLocation();
		return l;
	} 
 
	@Override 
5
CodeRank
This code example shows how to use the following methods:setFastestInterval, setNumUpdates, setPriority
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
 
	@Override 
	public void onCreate() { 
		super.onCreate(); 
		mLocationRequest = LocationRequest.create();
		mLocationRequest.setPriority( LocationRequest.PRIORITY_HIGH_ACCURACY );
		mLocationRequest.setInterval( GEOFENCE_TARGET_INTERVAL );
		mLocationRequest.setFastestInterval( GEOFENCE_LIMIT_INTERVAL );
		mLocationClient = new LocationClient( this, this, this );
		mUpdatesRequested = false;
		//mServiceConnected = false; 
	} 
 
	@Override 
	public void onLocationChanged( Location location ) {
		// we're intentionally not actually doing anything with these location updates; 
		// see http://kwazylabs.com/blog/google_geofencing/ 
		Log.e(TAG, "Location change: "+location.toString());
	} 
 
5
CodeRank
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
        customRequest = LocationRequest.create();
 
        /* 
         * Set the update interval 
         */ 
        customRequest.setInterval(INTERVAL_DURATION_IN_MILLISECONDS);
 
        // Use high accuracy 
        customRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
 
        // Set the interval ceiling to ten seconds 
        customRequest.setFastestInterval(FAST_INTERVAL_DURATION_IN_MILLISECONDS);
 
 
    } 
 
 
    @Override 
    public void onDestroy() { 
 
5
CodeRank
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
	 if(uiContext != null){
		this.uiContext  		= uiContext;
	 	this.fastestInterval    = fastest;
	 	this.normalInterval     = interval;
	 	locationRequest 		= LocationRequest.create();
	 	locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
	 	locationRequest.setInterval(MILLISECS_PER_SECS * normalInterval);
	 	locationRequest.setFastestInterval(MILLISECS_PER_SECS * fastestInterval);
	 	preferences 		= uiContext.getSharedPreferences("SharePreferences",Context.MODE_PRIVATE);
	 	editor				= preferences.edit();
	 	locationClient 		= new LocationClient(uiContext,this,this);
	 	isUpdatable 		= false;
	 } 
	} 
 
	public void pauseUpdate(){ 
       /* editor.putBoolean("KEY_UPDATES_ON", isUpdatable); 
        editor.commit(); */ 
		isUpdatable = false;
	} 
5
CodeRank
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
        millisIntervalBetweenRefresh = DEFAULT_LOCATION_UPDATES_INTERVAL_MILLIS;
 
        // Create a new global location parameters object 
        mLocationRequest = LocationRequest.create();
        // Set the update interval 
        mLocationRequest.setInterval(millisIntervalBetweenRefresh);
        // Use high accuracy 
        mLocationRequest.setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY);
        // Set the interval ceiling to one minute 
        mLocationRequest.setFastestInterval(ONE_MINUTE_MILLIS);
 
        // Create a new location client, using the enclosing class to handle callbacks. 
        mLocationClient = new LocationClient(caller, this, this);
 
    } 
 
    public static LocationManager instance(TripWithMeMain caller) {
        if (instance == null) {
            instance = new LocationManager(caller);
        } 
5
CodeRank
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
		if (servicesConnected()) { 
			locationClient = new LocationClient(activity, this, this);
 
			locationRequest = LocationRequest.create();
			// Use high accuracy 
			locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
			// Set the update interval to 5 seconds 
			locationRequest.setInterval(UPDATE_INTERVAL);
			// Set the fastest update interval to 1 second 
			locationRequest.setFastestInterval(FASTEST_INTERVAL);
		} 
	} 
	 
	private boolean servicesConnected() { 
		// Check that Google Play services is available 
		int resultCode = GooglePlayServicesUtil
				.isGooglePlayServicesAvailable(activity);
		// If Google Play services is available 
		if (ConnectionResult.SUCCESS == resultCode) {
			// In debug mode, log the status 
6
CodeRank
This code example shows how to use the following methods:setFastestInterval, setInterval, setPriority
		locationRequest = LocationRequest.create();
 
		/* 
		 * Set the update interval 
		 */ 
		locationRequest.setInterval(UPDATE_INTERVAL_IN_MILLISECONDS);
 
		// Use high accuracy 
		locationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
 
		// Set the interval ceiling to one minute 
		locationRequest
				.setFastestInterval(FAST_INTERVAL_CEILING_IN_MILLISECONDS);
 
	} 
 
	/** 
	 * Evento de conexión 
	 */ 
	public void onConnect() { 
5
CodeRank

Related Android LocationRequest Questions & Answers:

See Code Examples for Android LocationRequest Methods: