DeviceSamplingPackage class
The built-in sampling package for collecting information about the phone and the app.
Registered automatically in the SamplingPackageRegistry. Add a Measure
with one of the measure types below to a task in your protocol to use it.
All measures use the Smartphone primary device. It collects:
- device info (hardware and operating system information)
- installed app info (name, package name, version, etc.)
- battery level and charging status
- screen events (on/off/unlocked)
- app lifecycle events (inactive, hidden, paused, resumed, detached)
- free memory (physical and virtual)
- local time zone (e.g. "Europe/Copenhagen")
- heartbeat (periodic heartbeat from the device)
Screen events are only available on Android.
protocol.addTaskControl(
ImmediateTrigger(),
BackgroundTask(measures: [
Measure(type: DeviceSamplingPackage.BATTERY_STATE),
Measure(type: DeviceSamplingPackage.SCREEN_EVENT),
]),
phone,
);
- Inheritance
-
- Object
- SamplingPackage
- SmartphoneSamplingPackage
- DeviceSamplingPackage
Constructors
Properties
-
dataTypes
→ List<
DataTypeMetaData> -
The data types this package supports.
no setterinherited
-
deviceManager
→ DeviceManager<
DeviceConfiguration< DeviceRegistration> , DeviceRegistration> -
Get the DeviceManager for the device used by this package.
no setterinherited
- deviceType → String
-
The type of device this package collects data from.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- samplingSchemes → DataTypeSamplingSchemeMap
-
The default sampling schemes for all dataTypes in this package.
no setteroverride
Methods
-
create(
String type) → Probe? -
Creates a new Probe of the specified
type. Note thattypeshould be one of the dataTypes that this package supports. Returns null if a probe cannot be created for thetype.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onRegister(
) → void -
Called when this package is registered in the SamplingPackageRegistry.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- APP_LIFECYCLE_EVENT → const String
- Measure type for app lifecycle state events (inactive, hidden, paused, resumed, detached).
- APPLICATION_INFORMATION → const String
- Measure type for collection of basic application information like app name, package name, version, etc.
- BATTERY_STATE → const String
- Measure type for collection of battery level and charging status.
- DEVICE_INFORMATION → const String
- Measure type for collection of basic device information like device name, model, manufacturer, operating system, and hardware profile.
- FREE_MEMORY → const String
- Measure type for collection of free physical and virtual memory.
- HEARTBEAT → const String
- Measure type for a periodic heartbeat from the phone. Used to calculate sampling coverage over time.
- SCREEN_EVENT → const String
- Measure type for collection of screen events (on/off/unlocked).
- TIMEZONE → const String
- Measure type for collection of the time zone of the device. See List of tz database time zones for an overview of timezones.