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

This code example shows how to use the following methods:setAccuracy, setAltitude, setBearing, setExtras, setLatitude
This code example shows how to use the following methods:setAccuracy, setExtras, setLatitude, setLongitude
public class KnownStopLocationProviderService { 
	 
	public static final String KNOWN_STOP_LOCATION = "knownStopLocation";
	 
	public static Location makeLocationForSelectedStop(Stop stop) {
		final Location stopLocation = new Location(KNOWN_STOP_LOCATION);
		stopLocation.setAccuracy(1);
		stopLocation.setLatitude(stop.getLatitude());
		stopLocation.setLongitude(stop.getLongitude());
		Bundle extras = new Bundle();
		extras.putSerializable("stop", stop);
		stopLocation.setExtras(extras);
		return stopLocation;
	} 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getProvider, setExtras
	public void onLocationChanged(Location location) {
		if (location != null) {
			background.setLastTime(SystemClock.elapsedRealtime());
			background.setLastLocation(location);
			final Bundle b = new Bundle();
			b.putString("networkLocationType", location.getProvider());
			location.setExtras(b);
			location = LocationDataProvider.Stub.renameSource(location,
					IDENTIFIER);
			reportLocation(location);
		} 
	} 
 
	@Override 
	public boolean onMeetsCriteria(final Criteria criteria) {
		if (criteria.getAccuracy() == Criteria.ACCURACY_FINE) {
			return false; 
		} 
		if (criteria.isAltitudeRequired()) {
			return false; 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAccuracy, setAltitude, setExtras, setTime
                } 
                if (!time.equals(locationTime))
                { 
                    locationTime = time;
                    locationTimestamp = parseNmeaTime(time);
                    location.setTime(locationTimestamp);
                } 
                if (lat != null && !lat.equals(""))
                { 
                    location.setLatitude(parseNmeaLatitude(lat, latDir));
                } 
                if (lon != null && !lon.equals(""))
                { 
                    location.setLongitude(parseNmeaLongitude(lon, lonDir));
                } 
                if (hdop != null && !hdop.equals(""))
                { 
                    location.setAccuracy(Float.parseFloat(hdop) * precision);
                } 
                if (alt != null && !alt.equals(""))

5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:reset, setAccuracy, setAltitude, setBearing, setExtras
 
    /** 
     * @return a Location object if valid null otherwise 
     */ 
    public Location getLocation() {
        loc.reset();
        if (mFixDateTimeStamp != 0) loc.setTime(mFixDateTimeStamp);
        loc.setLatitude(mFixLatitude);
        loc.setLongitude(mFixLongitude);
        Bundle extras = new Bundle();
        extras.putInt(BUNDLE_SATS, mFixSatsTracked);
        loc.setExtras(extras);
        loc.setAccuracy(mFixAccuracy);
        loc.setAltitude(mFixAltitude);
        loc.setSpeed(mFixSpeed);
        loc.setBearing(mFixBearing);
        return loc;
    } 
 
    /** 
     * @param time UTC time 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getAccuracy, getLatitude, getLongitude, removeAltitude, removeBearing
     * <p>Second we snap-to-grid (quantize). This has the nice property of 
     * producing stable results, and mitigating against taking many samples 
     * to average out a random offset. 
     */ 
    private Location createCoarseLocked(Location fine) {
        Location coarse = new Location(fine);
 
        // clean all the optional information off the location, because 
        // this can leak detailed location information 
        coarse.removeBearing();
        coarse.removeSpeed();
        coarse.removeAltitude();
        coarse.setExtras(null);
 
        double lat = coarse.getLatitude();
        double lon = coarse.getLongitude();
 
        // wrap 
        lat = wrapLatitude(lat);
        lon = wrapLongitude(lon);

4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setExtras
        this._location.setBearing(_bearing);
        return this;
    } 
 
    public LocationBuilder extras(Bundle _extras) {
        this._location.setExtras(_extras);
        return this;
    } 
 
    public LocationBuilder latitude(double _latitude) {
        this._location.setLatitude(_latitude);
        return this;
    } 
 
    public LocationBuilder longitude(double _longitude) {
        this._location.setLongitude(_longitude);
        return this;
    } 
 
    public LocationBuilder provider(String _provider) {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
setExtras Method Overview
Sets the extra information associated with this fix to the given Bundle.
See Code Examples for other Android Location Methods: