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

This code example shows how to use the following methods:getAltitude, getExtras, getLatitude, getLongitude
		tv.addtext("NMEA Status changed\n");
	} 
 
	public void onLocationChanged(Location location) {
		TextView[] lPos=Pos;
		lPos[0].setText(Double.toString(location.getLatitude()));
		lPos[1].setText(Double.toString(location.getLongitude()));
		lPos[2].setText(Double.toString(location.getAltitude()));
		 
		int nsat=location.getExtras().getInt("satellites", -1);
		lPos[3].setText(Integer.toString(nsat));
	} 
 
	public void onProviderDisabled(String provider) {
		tv.addtext("GPS Provider Disabled\n");
	} 
 
	public void onProviderEnabled(String provider) {
		tv.addtext("GPS Provider Enabled\n");
	} 
7
CodeRank
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getLatitude
                                  boolean hasSpeed, double speed,
                                  boolean hasAccuracy, double accuracy,
                                  boolean hasAcceleration, double acceleration);
 
  private void sendLocation(Location location) {
    Bundle extras = location.getExtras();
 
    setLocation(location.getTime(),
                extras != null ? extras.getInt("satellites", -1) : -1,
                location.getLongitude(), location.getLatitude(),
                location.hasAltitude(), location.getAltitude(),
                location.hasBearing(), location.getBearing(),
                location.hasSpeed(), location.getSpeed(),
                location.hasAccuracy(), location.getAccuracy(),
                true, acceleration);
  } 
 
  private void setConnectedSafe(int connected) {
    if (!safeDestruct.Increment())
      return; 

7
CodeRank
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getLatitude
                                  boolean hasSpeed, double speed,
                                  boolean hasAccuracy, double accuracy,
                                  boolean hasAcceleration, double acceleration);
 
  private void sendLocation(Location location) {
    Bundle extras = location.getExtras();
 
    setLocation(location.getTime(),
                extras != null ? extras.getInt("satellites", -1) : -1,
                location.getLongitude(), location.getLatitude(),
                location.hasAltitude(), location.getAltitude(),
                location.hasBearing(), location.getBearing(),
                location.hasSpeed(), location.getSpeed(),
                location.hasAccuracy(), location.getAccuracy(),
                true, acceleration);
  } 
 
  private void setConnectedSafe(int connected) {
    if (!safeDestruct.Increment())
      return; 

6
CodeRank
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getSpeed
	 
	private void getSatelliteData(){ 
		if(loc != null){
			 
			//Num of satellites used for the fix 
			locBundle = loc.getExtras();
			if(locBundle != null){
				numberSats = locBundle.getInt("satellites",-1);
				 
			} 
			 
			satAccuracy = loc.getAccuracy();
			bearing = loc.getBearing();
			altitude = loc.getAltitude();
			speed = loc.getSpeed();
		} 
	} 
	 
	public void onPause(){ 
		super.onPause(); 
6
CodeRank
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getLatitude
	/////////////////Location Listener Functions 
	public void onLocationChanged(Location loc) {
		// TODO Auto-generated method stub 
		 
		TextView[] lTv=mTv;
		lTv[0].setText(loc.getProvider());
		lTv[1].setText(Float.toString(loc.getAccuracy()));
		lTv[2].setText(Double.toString(loc.getAltitude()));
		lTv[3].setText(Float.toString(loc.getBearing()));
		lTv[4].setText(Double.toString(loc.getLatitude()));
		lTv[5].setText(Double.toString(loc.getLongitude()));
		lTv[6].setText(Float.toString(loc.getSpeed()));
		lTv[7].setText(Long.toString(loc.getTime()));
		//TODO change this. 
		lTv[8].setText(loc.getExtras().toString());
		 
	} 
 
 
	public void onProviderDisabled(String arg0) {
6
CodeRank
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getLatitude
	Location l = mManager.getLastKnownLocation(mManager.GPS_PROVIDER);
	if (l == null) {
	    mLocation.append("Location: " + l);
	} else { 
	    mLocation.append("LastKnownLocation:\n" +
			     "  Provider  " + l.getProvider() + "\n" +
			     "  Time      " + l.getTime() + "\n" +
			     "  Latitude  " + l.getLatitude() + "\n" +
			     "  Longitude " + l.getLongitude() + "\n" +
			     "  Altitude  " + l.getAltitude() + "\n" +
			     "  Speed     " + l.getSpeed() + "\n" +
			     "  Bearing   " + l.getBearing() + "\n" +
			     "  Accuracy  " + l.getAccuracy() + "\n" +
			     "  Extras    " + l.getExtras() + "\n");
	} 
	     
	sendStatus(CHANGED_LOCATION);	    
    } 
} 
5
CodeRank
This code example shows how to use the following methods:getAccuracy, getAltitude, getBearing, getExtras, getLatitude
  private final double longitude;
  private final int numSatellites;
  private final float speed;
 
  public GPSPoint(Location location) {
    super(location.getTime());
 
    this.latitude = location.getLatitude();
    this.longitude = location.getLongitude();
 
    if (location.hasAccuracy()) {
      this.accuracy = location.getAccuracy();
    } else { 
      this.accuracy = Float.NaN;
    } 
 
    if (location.hasAltitude()) {
      this.altitude = location.getAltitude();
    } else { 
      this.altitude = Double.NaN;

4
CodeRank
This code example shows how to use the following methods:getExtras
    public float getSpeed() { 
        return mLocation.getSpeed();
    } 
 
    public Bundle getExtras() {
        return mLocation.getExtras();
    } 
 
    public Location getLocation() {
        return new Location(mLocation);
    } 
 
    @Override public String toString() {
        return "Waypoint[mLocation=" + mLocation + "]";
    } 
} 
4
CodeRank
getExtras Method Overview
Returns additional provider-specific information about the location fix as a Bundle.
See Code Examples for other Android Location Methods: