Protected
_nativeProtected
Abstract
createProtected
preProtected
addProtected
addIOSPropsStarts capturing.For Android, need to define interval & priority which need to be decided wisely; HIGH_ACCURACY, LOW_POWER , NO_POWER or BALANCED. iOS will ignore this priority.
start
0.1
Optional
priority: "HIGH_ACCURACY" | "BALANCED" | "LOW_POWER" | "NO_POWER"Optional
interval: numberGets last known location. The onFailure function will be triggered if no location data has ever been retrieved or unexpected error occurred.
getLastKnownLocation
4.0.2
Gets location latitude and longitude. Handles permissions by itself.
It either returns the permission result if permission is denied. If successful, it will return
import Location from '@smartface/native/device/location';
Location.getLocation()
.then(location => {
let requestOptions = {
'url': 'http://maps.googleapis.com/maps/api/geocode/json?latlng=' + location.latitude + ',' + location.longitude + '&sensor=true',
'method': 'GET'
};
})
.catch(e => {
// e is in the type of PermissionResult
console.log("Location cannot be retrieved");
});
Optional
shouldRequestPreciseLocation: booleanAndroid only. When set to true, it will request for precise location. When set to false, it will request for approximate location only
Optional
priority: "HIGH_ACCURACY" | "BALANCED" | "LOW_POWER" | "NO_POWER"Sets the priority of the location request. Defaults to BALANCED
Rest
...args: any[]Rest
...args: any[]Rest
...args: any[]Rest
...args: any[]Rest
...args: any[]Rest
...args: any[]Callback to capture location events.
onLocationChanged
0.1
import Location from '@smartface/native/device/location';
Location.on(Location.Events.LocationChanged, (params) => {
console.info('onLocationChanged', params);
});
Generated using TypeDoc
Since
0.1
Device.Location allows capturing location change events on the device. In Android, Permissions#location permission must be taken on run time for 23 api level and above.
Example