Packagecom.distriqt.extension.location
Classpublic class LocationRequest
InheritanceLocationRequest Inheritance Object

Defines options for location monitoring requests for the different platforms, such as intervals, accuracy and priority.



Public Properties
 PropertyDefined By
  accuracy : String = nearestTenMeters
The desired accuracy level to use when monitoring the device location.
LocationRequest
  duration : int = -1
Sets the duration (in milliseconds) this request will continue before being automatically removed Defaults to -1, which represents an unlimited duration.
LocationRequest
  fastestInterval : int = -1
Deprecated: No longer supported
Explicitly set the fastest interval for location updates, in milliseconds.
LocationRequest
  interval : int = 5000
Set the desired interval for active location updates, in milliseconds.
LocationRequest
  maxWaitTime : int = -1
Deprecated: No longer supported
Sets the maximum wait time in milliseconds for location updates.
LocationRequest
  persistInBackground : Boolean
[read-only] Since Android O, in order to receive consistent updates while your application is in the background a foreground service and corresponding notification must be used.
LocationRequest
  persistInBackgroundNotificationText : String
[read-only] Notification text for the foreground service notification
LocationRequest
  priority : int = 1
Set the priority of the request.
LocationRequest
  updateData : String
Additional data that will be sent with every update to the updataUrl.
LocationRequest
  updateMinimumInterval : int = 0
The minimum interval between updates to the server in milliseconds.
LocationRequest
  updateUrl : String
This is a url that the extension will attempt to send the location information to whenever a location update is received.
LocationRequest
Public Methods
 MethodDefined By
  
Constructor
LocationRequest
  
setAccuracy(accuracy:String):LocationRequest
LocationRequest
  
LocationRequest
  
setFastestInterval(fastestInterval:int):LocationRequest
LocationRequest
  
LocationRequest
  
LocationRequest
  
setPersistInBackground(persistInBackground:Boolean = true, notificationText:String = null):LocationRequest
Sets the value of persistInBackground
LocationRequest
  
LocationRequest
  
setServerUpdate(url:String, data:String, minimumInterval:int):LocationRequest
LocationRequest
Public Constants
 ConstantDefined By
  ACCURACY_BEST : String = best
[static]
LocationRequest
  ACCURACY_BEST_FOR_NAVIGATION : String = bestForNavigation
[static]
LocationRequest
  ACCURACY_HUNDRED_METERS : String = hundredMeters
[static]
LocationRequest
  ACCURACY_KILOMETER : String = kilometer
[static]
LocationRequest
  ACCURACY_NEAREST_TEN_METERS : String = nearestTenMeters
[static]
LocationRequest
  ACCURACY_THREE_KILOMETERS : String = threeKilometers
[static]
LocationRequest
  PRIORITY_BALANCED_POWER_ACCURACY : int = 1
[static] To request "block" level accuracy.
LocationRequest
  PRIORITY_HIGH_ACCURACY : int = 0
[static] To request the most accurate locations available.
LocationRequest
  PRIORITY_LOW_POWER : int = 2
[static] To request "city" level accuracy.
LocationRequest
  PRIORITY_NO_POWER : int = 3
[static] To request the best accuracy possible with zero additional power consumption.
LocationRequest
Property Detail
accuracyproperty
public var accuracy:String = nearestTenMeters

The desired accuracy level to use when monitoring the device location.

Use with an accuracy constant such as ACCURACY_BEST_FOR_NAVIGATION. No other values are accepted.

The location service will try its best to achieve your desired accuracy. However, it is not guaranteed. To optimize power performance, be sure to specify an appropriate accuracy for your usage scenario (eg, use a large accuracy value when only a coarse location is needed). More precise locations generally require higher battery usage.

Support: iOS only

durationproperty 
public var duration:int = -1

Sets the duration (in milliseconds) this request will continue before being automatically removed Defaults to -1, which represents an unlimited duration. Support: Android only

fastestIntervalproperty 
public var fastestInterval:int = -1
Deprecated: No longer supported

Explicitly set the fastest interval for location updates, in milliseconds.

This controls the fastest rate at which your application will receive location updates, which might be faster than interval in some situations (for example, if other applications are triggering location updates).

This allows your application to passively acquire locations at a rate faster than it actively acquires locations, saving power.

Unlike interval, this parameter is exact. Your application will never receive updates faster than this value.

If you don't set this value, a fastest interval will be selected for you. It will be a value faster than your active interval.

An interval of 0 is allowed, but not recommended, since location updates may be extremely fast on future implementations.

Support: Android only

intervalproperty 
public var interval:int = 5000

Set the desired interval for active location updates, in milliseconds.

The location client will actively try to obtain location updates for your application at this interval, so it has a direct influence on the amount of power used by your application. Choose your interval wisely.

This interval is inexact. You may not receive updates at all (if no location sources are available), or you may receive them slower than requested. You may also receive them faster than requested (if other applications are requesting location at a faster interval). The fastest rate that that you will receive updates can be controlled with fastestInterval. By default this fastest rate is 6x the interval frequency.

Applications with only the coarse location permission may have their interval silently throttled.

An interval of 0 is allowed, but not recommended, since location updates may be extremely fast on future implementations.

Support: Android only

maxWaitTimeproperty 
public var maxWaitTime:int = -1
Deprecated: No longer supported

Sets the maximum wait time in milliseconds for location updates.

If you pass a value at least 2x larger than the interval specified with interval, then location delivery may be delayed and multiple locations can be delivered at once. Locations are determined at the interval rate, but can be delivered in batch after the interval you set in this method. This can consume less battery and give more accurate locations, depending on the device's hardware capabilities. You should set this value to be as large as possible for your needs if you don't need immediate location delivery.

Support: Android only

persistInBackgroundproperty 
persistInBackground:Boolean  [read-only]

Since Android O, in order to receive consistent updates while your application is in the background a foreground service and corresponding notification must be used. When this is true the extension will use a foreground service to perform location monitoring and updates and handle display of the required notification (required by Android for foreground services).

If you require consistent updates to the location while your application is in the background you must set this to true using the setPersistInBackground() function.

If this is false then your applications location updates may be throttled when in the background and batched together at least frequent intervals ignoring any options specified in this request.

Android only, ignored on iOS


Implementation
    public function get persistInBackground():Boolean

See also

persistInBackgroundNotificationTextproperty 
persistInBackgroundNotificationText:String  [read-only]

Notification text for the foreground service notification


Implementation
    public function get persistInBackgroundNotificationText():String
priorityproperty 
public var priority:int = 1

Set the priority of the request.

Use with a priority constant such as PRIORITY_HIGH_ACCURACY. No other values are accepted.

The priority of the request is a strong hint for which location sources to use. For example, PRIORITY_HIGH_ACCURACY is more likely to use GPS, and PRIORITY_BALANCED_POWER_ACCURACY is more likely to use WIFI and Cell tower positioning, but it also depends on many other factors (such as which sources are available) and is implementation dependent.

On iOS these values control whether the location services use the significant location updates or the standard and significant locations updates.

Support:

updateDataproperty 
public var updateData:String

Additional data that will be sent with every update to the updataUrl. This can be used to identify this device or user in your server code.

updateMinimumIntervalproperty 
public var updateMinimumInterval:int = 0

The minimum interval between updates to the server in milliseconds.

This allows you to limit the request frequency to your server. It is not a guaranteed interval but the minimum interval that will be between sequential updates from a device. This interval may be longer if the device does not receive a location update during that interval.

If 0, then every location update will be sent.

updateUrlproperty 
public var updateUrl:String

This is a url that the extension will attempt to send the location information to whenever a location update is received.

This can be useful in situations where the application is running in the background (or even terminated on Android) the update url will still be contacted where AS3 code may not run.

The payload sent to the url takes the following form:

         {
          "location": {
              "altitude": 0.00,
              "latitude": 0.00,
              "longitude": 0.00,
              "timestamp": 000000000
          },
          "data": "YOUR_CUSTOM_DATA_STRING"
         }
         

Constructor Detail
LocationRequest()Constructor
public function LocationRequest()

Constructor

Method Detail
setAccuracy()method
public function setAccuracy(accuracy:String):LocationRequest

Parameters

accuracy:String

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setDuration()method 
public function setDuration(duration:int):LocationRequest

Parameters

duration:int

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setFastestInterval()method 
public function setFastestInterval(fastestInterval:int):LocationRequest

Parameters

fastestInterval:int

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setInterval()method 
public function setInterval(interval:int):LocationRequest

Parameters

interval:int

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setMaxWaitTime()method 
public function setMaxWaitTime(maxWaitTime:int):LocationRequest

Parameters

maxWaitTime:int

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setPersistInBackground()method 
public function setPersistInBackground(persistInBackground:Boolean = true, notificationText:String = null):LocationRequest

Sets the value of persistInBackground

Parameters

persistInBackground:Boolean (default = true) — Whether to persist location updates in the background
 
notificationText:String (default = null) — The text displayed in the notification

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setPriority()method 
public function setPriority(priority:int):LocationRequest

Parameters

priority:int

Returns
LocationRequestLocationRequest instance for chaining calls

See also

setServerUpdate()method 
public function setServerUpdate(url:String, data:String, minimumInterval:int):LocationRequest

Parameters

url:String
 
data:String
 
minimumInterval:int

Returns
LocationRequestLocationRequest instance for chaining calls

See also

Constant Detail
ACCURACY_BESTConstant
public static const ACCURACY_BEST:String = best

ACCURACY_BEST_FOR_NAVIGATIONConstant 
public static const ACCURACY_BEST_FOR_NAVIGATION:String = bestForNavigation

ACCURACY_HUNDRED_METERSConstant 
public static const ACCURACY_HUNDRED_METERS:String = hundredMeters

ACCURACY_KILOMETERConstant 
public static const ACCURACY_KILOMETER:String = kilometer

ACCURACY_NEAREST_TEN_METERSConstant 
public static const ACCURACY_NEAREST_TEN_METERS:String = nearestTenMeters

ACCURACY_THREE_KILOMETERSConstant 
public static const ACCURACY_THREE_KILOMETERS:String = threeKilometers

PRIORITY_BALANCED_POWER_ACCURACYConstant 
public static const PRIORITY_BALANCED_POWER_ACCURACY:int = 1

To request "block" level accuracy.

Block level accuracy is considered to be about 100 meter accuracy. Using a coarse accuracy such as this often consumes less power.

On iOS this will use both standard and significant update modes. If you only have the "in-use" permission then you will not get significant updates but only the standard updates.

PRIORITY_HIGH_ACCURACYConstant 
public static const PRIORITY_HIGH_ACCURACY:int = 0

To request the most accurate locations available.

This will return the finest location available.

On iOS this will use both standard and significant update modes. If you only have the "in-use" permission then you will not get significant updates but only the standard updates.

PRIORITY_LOW_POWERConstant 
public static const PRIORITY_LOW_POWER:int = 2

To request "city" level accuracy.

City level accuracy is considered to be about 10km accuracy. Using a coarse accuracy such as this often consumes less power.

On iOS this will use the significant update mode only if you have the always permission otherwise it will use the standard updates.

PRIORITY_NO_POWERConstant 
public static const PRIORITY_NO_POWER:int = 3

To request the best accuracy possible with zero additional power consumption.

No locations will be returned unless a different client has requested location updates in which case this request will act as a passive listener to those locations.

On iOS this will use the significant update mode only if you have the always permission otherwise it will use the standard updates.