onConfigure method
Callback on configure.
When called, the configuration and the registration is available.
Is to be overridden in sub-classes. Note, however, that it must not be doing a lot of work on startup.
Implementation
@override
void onConfigure() {
// listen to the battery
_battery.onBatteryStateChanged.listen((state) async {
try {
_batteryLevel = await _battery.batteryLevel;
} catch (error) {
// Battery info is unavailable on some platforms (e.g. the iOS simulator).
warning('$runtimeType - could not read battery level: $error');
}
});
// find the supported data types
for (var package in SamplingPackageRegistry().packages) {
if (package is SmartphoneSamplingPackage) {
_supportedDataTypes.addAll(
package.dataTypes.map((type) => DataType.fromString(type.type)),
);
}
}
}