Send the correct background task handler to the app

This commit is contained in:
vishnukvmd 2021-11-27 21:04:31 +05:30
parent 03152dcaf2
commit 9ad2e34e3a

View file

@ -65,17 +65,17 @@ Future<void> _runInForeground() async {
});
}
Future _runInBackground(String taskId) async {
Future _runBackgroundTask(String taskId) async {
if (_initializationStatus == null) {
_runWithLogs(() async {
_runBackgroundTask(taskId);
_runInBackground(taskId);
}, prefix: "[bg]");
} else {
_runBackgroundTask(taskId);
_runInBackground(taskId);
}
}
Future<void> _runBackgroundTask(String taskId) async {
Future<void> _runInBackground(String taskId) async {
await Future.delayed(Duration(seconds: 3));
if (await _isRunningInForeground()) {
_logger.info("FG task running, skipping BG task");