onStart method
Callback when this executor is started. Returns true if successfully started, false otherwise.
Implementation
@override
Future<bool> onStart() async {
_subscription ??= SmartPhoneClientManager()
.getStudyRuntime(deployment!.studyDeploymentId)
?.measurementsByType(configuration!.measureType)
.distinct()
.listen((measurement) {
if (configuration?.triggerCondition == null) {
// always trigger if the condition is null
onTrigger();
} else
// check the trigger condition
if (measurement.data.equivalentTo(configuration!.triggerCondition!)) {
onTrigger();
}
});
return true;
}