diff options
Diffstat (limited to 'location')
-rw-r--r-- | location/java/android/location/Location.java | 42 | ||||
-rw-r--r-- | location/java/android/location/LocationRequest.java | 2 |
2 files changed, 43 insertions, 1 deletions
diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java index 83f8564..d66aa0d 100644 --- a/location/java/android/location/Location.java +++ b/location/java/android/location/Location.java @@ -59,6 +59,16 @@ public class Location implements Parcelable { */ public static final int FORMAT_SECONDS = 2; + /** + * @hide + */ + public static final String EXTRA_COARSE_LOCATION = "coarseLocation"; + + /** + * @hide + */ + public static final String EXTRA_NO_GPS_LOCATION = "noGPSLocation"; + private String mProvider; private long mTime = 0; private long mElapsedRealtimeNano = 0; @@ -893,4 +903,36 @@ public class Location implements Parcelable { parcel.writeFloat(mAccuracy); parcel.writeBundle(mExtras); } + + /** + * Returns one of the optional extra {@link Location}s that can be attached + * to this Location. + * + * @param key the key associated with the desired extra Location + * @return the extra Location, or null if unavailable + * @hide + */ + public Location getExtraLocation(String key) { + if (mExtras != null) { + Parcelable value = mExtras.getParcelable(key); + if (value instanceof Location) { + return (Location) value; + } + } + return null; + } + + /** + * Attaches an extra {@link Location} to this Location. + * + * @param key the key associated with the Location extra + * @param location the Location to attach + * @hide + */ + public void setExtraLocation(String key, Location value) { + if (mExtras == null) { + mExtras = new Bundle(); + } + mExtras.putParcelable(key, value); + } } diff --git a/location/java/android/location/LocationRequest.java b/location/java/android/location/LocationRequest.java index b1863b8..f4f7b09 100644 --- a/location/java/android/location/LocationRequest.java +++ b/location/java/android/location/LocationRequest.java @@ -144,7 +144,7 @@ public final class LocationRequest implements Parcelable { private int mNumUpdates = Integer.MAX_VALUE; // no expiry private float mSmallestDisplacement = 0.0f; // meters - private String mProvider = null; // for deprecated API's that explicitly request a provider + private String mProvider = LocationManager.FUSED_PROVIDER; // for deprecated APIs that explicitly request a provider /** * Create a location request with default parameters. |