Skip to content

Commit

Permalink
[TIMOB-20522] Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gary Mathews committed Nov 29, 2017
1 parent c9a1662 commit e6630b3
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions apidoc/Titanium/Geolocation/Geolocation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,39 @@ description: |
[frequency](Titanium.Geolocation.frequency) property. The `preferredProvider`
and `frequency` properties are not used in any other mode.
As of Titanium SDK 7.1.0 and later, Google Play Services is used by default to obtain location information.
This means the provider passed into [createLocationProvider](Titanium.Geolocation.createLocationProvider) will
As of Titanium SDK 7.1.0 and later, including `ti.playservices` will allow Google Play Services to be used by
default to obtain location information. This means the provider passed into [createLocationProvider](Titanium.Geolocation.createLocationProvider) will
be ignored, as Google Play Services will select the best provider based on current device conditions.
If Google Play Services is not available it will fallback to previous behaviour of using Android location APIs.
To retrieve location events:
var win = Ti.UI.createWindow({backgroundColor: 'gray'});
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_HIGH;
function getLocation() {
Ti.Geolocation.addEventListener('location', function(e) {
alert(JSON.stringify(e, null, 2));
});
}
win.addEventListener('open', function(){
if(Ti.Geolocation.hasLocationPermissions()){
getLocation();
}else{
Ti.Geolocation.requestLocationPermissions(Ti.Geolocation.AUTHORIZATION_ALWAYS, function(e){
if (e.success) {
getLocation();
} else {
alert('could not obtain location permissions');
}
});
}
});
win.open();
#### Using the Compass
Both iOS and Android support a receiving heading updates from a hardware compass, if available.
Expand Down Expand Up @@ -400,6 +428,8 @@ properties:
type: Number
permission: read-only
platforms: [android, iphone, ipad]
deprecated:
since: "2.0.0"

- name: ACCURACY_HUNDRED_METERS
summary: |
Expand All @@ -411,6 +441,8 @@ properties:
type: Number
permission: read-only
platforms: [android, iphone, ipad]
deprecated:
since: "2.0.0"

- name: ACCURACY_KILOMETER
summary: |
Expand All @@ -422,6 +454,8 @@ properties:
type: Number
permission: read-only
platforms: [android, iphone, ipad]
deprecated:
since: "2.0.0"

- name: ACCURACY_NEAREST_TEN_METERS
summary: |
Expand All @@ -433,6 +467,8 @@ properties:
type: Number
permission: read-only
platforms: [android, iphone, ipad]
deprecated:
since: "2.0.0"

- name: ACCURACY_THREE_KILOMETERS
summary: |
Expand All @@ -444,6 +480,8 @@ properties:
type: Number
permission: read-only
platforms: [android, iphone, ipad]
deprecated:
since: "2.0.0"

- name: ACCURACY_HIGH
summary: |
Expand Down

0 comments on commit e6630b3

Please sign in to comment.