onNotification method
Starts the background sensing when the user taps the notification.
When the background sensing pauses, the task is marked as done.
Implementation
@mustCallSuper
@override
void onNotification() {
super.onNotification();
onStart();
// Listen to when the background sensing pauses.
// We do this because this background sensing task is never explicitly
// marked as done - it just runs until the background sensing pauses.
backgroundTaskExecutor.stateEvents.where((state) => state == ExecutorState.Paused).listen((state) {
debug('$runtimeType - Background sensing has paused - making this user task done.');
onDone();
});
}