JulianAssmann / flutter_background

A flutter plugin to keep apps running in the background via foreground services. Android only.
https://pub.dev/packages/flutter_background
MIT License
85 stars 45 forks source link

[BUG] AnimationController callback is not executing in background mode #64

Open JLoRenderer opened 1 year ago

JLoRenderer commented 1 year ago

Describe the bug Callback form an AnimationController is not executing in background mode.

To Reproduce AnimationController? _controller; _controller = AnimationController( vsync: this, duration: Duration(seconds: 10), ); _controller!.addStatusListener((status) { switch (status) { case AnimationStatus.forward: _onStart(); break;

    case AnimationStatus.reverse:
      _onStart();
      break;

    case AnimationStatus.dismissed:
      _onComplete();
      break;
    case AnimationStatus.completed:

    default:
    // Do nothing
  }

void _onComplete() { debugPrint("this does not get called while the screen is off"); }

Expected behavior The animation should be continiued in the background and the callback should be called, after AnimationStatus is updated.

Screenshots Not applicable.

Smartphone:

Logs I don't feel comfortable to share this information , but I looked at it and there was nothing which would explain this. ``` ``` flutter doctor -v [√] Flutter (Channel stable, 3.0.5, on Microsoft Windows [Version 10.0.19044.2130], locale de-DE) • Flutter version 3.0.5 at C:\src\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (3 months ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2 [√] Android toolchain - develop for Android devices (Android SDK version 32.0.0-rc1) • Android SDK at C:\Users\Johannes\AppData\Local\Android\Sdk • Platform android-Tiramisu, build-tools 32.0.0-rc1 • ANDROID_HOME = C:\Users\Johannes\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.3) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.2.32526.322 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2021.2) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+7-b1504.28-7817840) [√] VS Code, 64-bit edition (version 1.71.2) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.48.0 [√] Connected device (4 available) • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 32) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2130] • Chrome (web) • chrome • web-javascript • Google Chrome 106.0.5249.119 • Edge (web) • edge • web-javascript • Microsoft Edge 105.0.1343.42 [√] HTTP Host Availability • All required HTTP hosts are available • No issues found! ``` ```
JLoRenderer commented 1 year ago

To clarify: The animation continues while the screen is off , but the callback is not executed.

atreeon commented 1 year ago

Did you manage to get this to work @JLoRenderer ?

JLoRenderer commented 1 year ago

@atreeon Sadly not, but I also didn't try very hard, was just for a personal project. Also was a long time ago, don't know if it is fixed yet.