Skip to content

Commit

Permalink
fix(android): support Geolocation altitudeAccuracy (#11275)
Browse files Browse the repository at this point in the history
* fix(android): support altitude_accuracy on android 26+

* docs(android): specify min supported android version
  • Loading branch information
garymathews authored and ssaddique committed Oct 16, 2019
1 parent be984a1 commit ac32e75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Expand Up @@ -786,14 +786,19 @@ private boolean shouldUseUpdate(Location newLocation)
* @return map of property names and values that contain information
* pulled from the specified location
*/
@SuppressWarnings("NewApi")
private KrollDict buildLocationEvent(Location location, LocationProvider locationProvider)
{
KrollDict coordinates = new KrollDict();
coordinates.put(TiC.PROPERTY_LATITUDE, location.getLatitude());
coordinates.put(TiC.PROPERTY_LONGITUDE, location.getLongitude());
coordinates.put(TiC.PROPERTY_ALTITUDE, location.getAltitude());
coordinates.put(TiC.PROPERTY_ACCURACY, location.getAccuracy());
coordinates.put(TiC.PROPERTY_ALTITUDE_ACCURACY, null); // Not provided
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
coordinates.put(TiC.PROPERTY_ALTITUDE_ACCURACY, location.getVerticalAccuracyMeters());
} else {
coordinates.put(TiC.PROPERTY_ALTITUDE_ACCURACY, null);
}
coordinates.put(TiC.PROPERTY_HEADING, location.getBearing());
coordinates.put(TiC.PROPERTY_SPEED, location.getSpeed());
coordinates.put(TiC.PROPERTY_TIMESTAMP, location.getTime());
Expand Down
1 change: 1 addition & 0 deletions apidoc/Titanium/Geolocation/Geolocation.yml
Expand Up @@ -869,6 +869,7 @@ properties:
- name: altitudeAccuracy
summary: Vertical accuracy of the location update, in meters.
type: Number
osver: { android: { min: "8.0.0" } }

- name: heading
summary: |
Expand Down

0 comments on commit ac32e75

Please sign in to comment.