LocationService class

A connected device that gives access to the phone's location.

Add it to a protocol with addConnectedDevice to enable the ContextSamplingPackage.LOCATION, ContextSamplingPackage.GEOFENCE and ContextSamplingPackage.MOBILITY measures. Its settings (accuracy, distance, interval, Android notification) configure the shared LocationManager via LocationServiceManager.

Inheritance
  • Object
  • Serializable
  • DeviceConfiguration<ServiceRegistration>
  • CamsDevice<ServiceRegistration>
  • ServiceConfiguration<ServiceRegistration>
  • LocationService
Annotations
  • @JsonSerializable.new(includeIfNull: false, explicitToJson: true)

Constructors

LocationService({String? roleName, GeolocationAccuracy accuracy = GeolocationAccuracy.balanced, double distance = 10, Duration interval = const Duration(minutes: 1), String? notificationTitle, String? notificationMessage, String? notificationDescription, String? notificationIconName, bool notificationOnTapBringToFront = false})
Create and configure a LocationService.
LocationService.fromJson(Map<String, dynamic> json)
factory

Properties

$type ↔ String?
The type name written to __type in JSON; set to jsonType on creation.
getter/setter pairinherited
accuracy ↔ GeolocationAccuracy
Defines the desired accuracy that should be used to determine the location data. Default value is GeolocationAccuracy.balanced.
getter/setter pair
dataTypeSamplingSchemes → DataTypeSamplingSchemeMap?
Sampling schemes for all the sensors available on this device.
no setterinherited
defaultSamplingConfiguration ↔ Map<String, SamplingConfiguration>?
Sampling configurations which override the default configurations for data types available on this device, mapped by data type.
getter/setter pairinherited
distance ↔ double
The minimum distance in meters a device must move horizontally before an update event is generated. Specify 0 when you want to be notified of all movements.
getter/setter pair
fromJsonFunction → Function
The generated function that converts a JSON map to an object of this type.
no setteroverride
hashCode → int
The hash code for this object.
no setterinherited
interval ↔ Duration
The time interval between location updates.
getter/setter pair
isOptional ↔ bool?
Determines whether device registration for this device is optional prior to starting a study, i.e., whether the study can run without this device or not.
getter/setter pairinherited
jsonType → String
The __type used for JSON serialization of this class.
no setterinherited
notificationDescription ↔ String?
The longer description in the notification to be shown to the user when location tracking takes place in the background. Only used on Android.
getter/setter pair
notificationIconName ↔ String?
Name of the notification icon in the android/app/src/main/res/drawable folder. Only used on Android.
getter/setter pair
notificationMessage ↔ String?
The message in the notification to be shown to the user when location tracking takes place in the background. Only used on Android.
getter/setter pair
notificationOnTapBringToFront ↔ bool
Should the app be brought to the front on tap? Default is false.
getter/setter pair
notificationTitle ↔ String?
The title of the notification to be shown to the user when location tracking takes place in the background. Only used on Android.
getter/setter pair
roleName ↔ String
A name which describes how the device participates within the study protocol; its 'role'. For example, 'Parent's phone' or 'Child phone'. Must be unique within a protocol.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
supportedDataTypes → Set<String>?
The set of data types which can be collected on this device.
no setterinherited
type → String
The device type identifier, i.e. its jsonType.
no setterinherited

Methods

acceptedRegistration(DeviceRegistration registration) → DeviceRegistration
The registration in the form the deployment service accepts for this device.
inherited
createRegistration({String? deviceId, String? deviceDisplayName}) → ServiceRegistration
Create a DeviceRegistration which can be used to configure this device for deployment.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Returns a JSON map of this object, including the __type property.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

DEFAULT_ROLE_NAME → const String
The default role name for a location service.
DEVICE_TYPE → const String
The type of a location service.