Sitelet https://web.archive.org/web/20210416063444/https://github.com/flutter/flutter/issues/57594
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppLifeCycleState.detached is not called when app is closed quickly #57594

Open
maheshkumar2150 opened this issue May 19, 2020 · 14 comments
Open

AppLifeCycleState.detached is not called when app is closed quickly #57594

maheshkumar2150 opened this issue May 19, 2020 · 14 comments

Comments

@maheshkumar2150
Copy link

@maheshkumar2150 maheshkumar2150 commented May 19, 2020 •

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() {
    return _MyHomePageState();
  }
}

class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);
  }

  @override
  void dispose() {
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    print(state);
  }

  @override
  Widget build(BuildContext context) {    

    return WillPopScope(
      onWillPop: () async {
        //do something here before pop
        return true;
      },
      child: Scaffold(
        body: Container(),
      ),
    );
  }
}
I/flutter (29405): AppLifecycleState.paused
I/flutter (29405): AppLifecycleState.resumed
I/flutter (29405): AppLifecycleState.inactive
I/flutter (29405): AppLifecycleState.paused
I/flutter (29405): AppLifecycleState.resumed
I/flutter (29405): AppLifecycleState.inactive
I/flutter (29405): AppLifecycleState.paused
I/flutter (29405): AppLifecycleState.resumed
I/flutter (29405): AppLifecycleState.inactive
I/flutter (29405): AppLifecycleState.paused
Lost connection to device. //i just closed the app now. (pressed overview button and closed the app by swiping)

AppLifecycleState.Detached was not printed.
Nothing was saved in database in my real app.

But if i close the app by pressing the back button,

I/flutter (30178): AppLifecycleState.inactive
I/flutter (30178): AppLifecycleState.paused
I/flutter (30178): AppLifecycleState.detached
detached was called.

WillPopScore is handling the back button press.
So when the user closed app with overview button, i want to store the last activity in database and i want to resume it when the app opens again.

I am making an app for android and ios.
The above code was tested with android in windows.

Flutter 1.17.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f7a6a7906b (7 days ago) • 2020-05-12 18:39:00 -0700
Engine • revision 6bc433c6b6
Tools • Dart 2.8.2
@iapicca
Copy link
Contributor

@iapicca iapicca commented May 20, 2020

Hi @maheshkumar2150
I tested your code with the latest master

[   +3 ms] Flutter run key commands.
[   +2 ms] r Hot reload. 🔥🔥🔥
[   +1 ms] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] An Observatory debugger and profiler on Pixel 3a is available at: http://127.0.0.1:56690/h8eHhwkXxs0=/
[ +268 ms] I/flutter (25063): initState() called
[+7275 ms] I/flutter (25063): AppLifecycleState.inactive
[  +58 ms] I/flutter (25063): AppLifecycleState.paused
[+2080 ms] I/flutter (25063): AppLifecycleState.resumed
[+1507 ms] I/flutter (25063): AppLifecycleState.inactive
[  +53 ms] I/flutter (25063): AppLifecycleState.paused
[+2081 ms] I/flutter (25063): AppLifecycleState.detached
[ +804 ms] Service protocol connection closed.
[   +3 ms] Lost connection to device.
[   +9 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +8 ms] Exit code 0 from: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +1 ms] 965AY0WP5C tcp:56690 tcp:39929
[   +3 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --remove tcp:56690
[  +16 ms] DevFS: Deleting filesystem on the device (file:///data/user/0/com.example.master/code_cache/masterLAGHAW/master/)
[ +263 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[   +9 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +9 ms] Exit code 0 from: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +4 ms] "flutter run" took 54,173ms.
[ +262 ms] Running shutdown hooks
[   +1 ms] Shutdown hook priority 4
[   +3 ms] Shutdown hooks complete
doctor
[✓] Flutter (Channel master, 1.19.0-2.0.pre.131, on Mac OS X 10.15.4 19E287, locale en-EE)
    • Flutter version 1.19.0-2.0.pre.131 at /Users/nevercode/development/flutter_master
    • Framework revision 478d4c9c1a (5 hours ago), 2020-05-19 20:22:01 -0700
    • Engine revision 2d4e83921d
    • Dart version 2.9.0 (build 2.9.0-9.0.dev 40f7a11d89)


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/nevercode/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.9.0

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.10.2

[✓] Connected device (3 available)
    • Pixel 3a   • 965AY0WP5C • android-arm64  • Android 10 (API 29)
    • Web Server • web-server • web-javascript • Flutter Tools
    • Chrome     • chrome     • web-javascript • Google Chrome 81.0.4044.138

• No issues found!

while with the current stable it behaves as you described

[   +3 ms] Flutter run key commands.
[   +2 ms] r Hot reload. 🔥🔥🔥
[   +1 ms] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] An Observatory debugger and profiler on Pixel 3a is available at: http://127.0.0.1:56917/ZnQHWAVVOYE=/
[  +20 ms] I/flutter (25520): initState() called
[+5022 ms] I/flutter (25520): AppLifecycleState.inactive
[  +66 ms] I/flutter (25520): AppLifecycleState.paused
[ +596 ms] I/flutter (25520): AppLifecycleState.resumed
[+6270 ms] I/flutter (25520): AppLifecycleState.inactive
[  +41 ms] I/flutter (25520): AppLifecycleState.paused
[+3523 ms] Service protocol connection closed.
[   +2 ms] Lost connection to device.
[   +7 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[  +10 ms] Exit code 0 from: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[        ] 965AY0WP5C tcp:56917 tcp:37845
[   +2 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --remove tcp:56917
[  +16 ms] DevFS: Deleting filesystem on the device (file:///data/user/0/com.example.stable/code_cache/stableLQBTZK/stable/)
[   +2 ms] Sending to VM service: _deleteDevFS({fsName: stable})
[ +263 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[   +3 ms] executing: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +8 ms] Exit code 0 from: /Users/nevercode/Library/Android/sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +2 ms] "flutter run" took 51,872ms.
doctor
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.4 19E287, locale en-EE)
    • Flutter version 1.17.1 at /Users/nevercode/development/flutter
    • Framework revision f7a6a7906b (7 days ago), 2020-05-12 18:39:00 -0700
    • Engine revision 6bc433c6b6
    • Dart version 2.8.2


[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    • Android SDK at /Users/nevercode/Library/Android/sdk
    • Platform android-29, build-tools 29.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.3.1, Build version 11C504
    • CocoaPods version 1.9.0

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.1.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.10.2

[✓] Connected device (1 available)
    • Pixel 3a • 965AY0WP5C • android-arm64 • Android 10 (API 29)

• No issues found!
Thank you
@maheshkumar2150
Copy link
Author

@maheshkumar2150 maheshkumar2150 commented May 20, 2020

What is latest mater? Is it better than stable version? Because it seems to me. Stable has bug but master hasn't.

Can you guide me to upgrade to latest master version?

@iapicca
Copy link
Contributor

@iapicca iapicca commented May 20, 2020 •

Hi @maheshkumar2150
please be aware that
it is true that the master channel is the more "up-to-date",
but also changes very quickly;
the stable version is "more stable".

If you decide to upgrade please follow the docs
Thank you

@EnricoSignoriWeDoc
Copy link

@EnricoSignoriWeDoc EnricoSignoriWeDoc commented May 27, 2020

There is no way to use it in stable?

@eleomilagrosa
Copy link

@eleomilagrosa eleomilagrosa commented Nov 23, 2020 •

It is working as expected in Android but in iOS,
detached is not getting called when pressed overview button and closed the app by swiping.

can anyone verify that it is working in master channel in iOS platform?

I am using
Flutter (Channel stable, 1.22.4)

@iapicca
Copy link
Contributor

@iapicca iapicca commented Nov 23, 2020

tagging @pedromassango for visibility

@eleomilagrosa
Copy link

@eleomilagrosa eleomilagrosa commented Nov 24, 2020 •

I know this is separate issue
but even dispose is not also getting called
when pressed overview button and closed the app by swiping in iOS.

working properly in Android

@pedromassangocode
Copy link
Member

@pedromassangocode pedromassangocode commented Nov 25, 2020

I tested this and here is my feedback

Pressed overview button and closed the app by swiping (master channel)

I/flutter (31534): AppLifecycleState.inactive
I/flutter (31534): AppLifecycleState.paused
I/flutter (31534): AppLifecycleState.detached
Lost connection to device.

Closed the app by pressing the back button (master channel)

I/flutter ( 2482): AppLifecycleState.inactive
I/flutter ( 2482): AppLifecycleState.paused
I/flutter ( 2482): AppLifecycleState.detached

Pressed overview button and closed the app by swiping (stable channel)

I/flutter ( 4328): AppLifecycleState.inactive
I/flutter ( 4328): AppLifecycleState.paused
I/flutter ( 4328): AppLifecycleState.detached

Closed the app by pressing the back button (stable channel)

I/flutter ( 5976): AppLifecycleState.inactive
I/flutter ( 5976): AppLifecycleState.paused
I/flutter ( 5976): AppLifecycleState.detached
Lost connection to device.

The issue

If you press the overview button and closed the app by swiping quickly, then the only method getting called it AppLifecycleState.inactive. And your output will be:

I/flutter ( 9358): AppLifecycleState.inactive
Lost connection to device.

So this is still valid.

flutter doctor -v (stable)
[✓] Flutter (Channel stable, 1.22.4, on Mac OS X 10.15.7 19H2 darwin-x64, locale en)
    • Flutter version 1.22.4 at /Users/pedromassango/dev/SDKs/flutter_stable
    • Framework revision 1aafb3a8b9 (12 days ago), 2020-11-13 09:59:28 -0800
    • Engine revision 2c956a31c0
    • Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/pedromassango/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.3

[!] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2020.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin installed
    • Dart plugin version 202.8070

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (1 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)

! Doctor found issues in 1 category.
flutter doctor -v (master)
[✓] Flutter (Channel master, 1.24.0-8.0.pre.365, on Mac OS X 10.15.7 19H2 darwin-x64, locale en)
    • Flutter version 1.24.0-8.0.pre.365 at /Users/pedromassango/dev/SDKs/flutter_master
    • Framework revision 2ceb371d21 (11 hours ago), 2020-11-24 17:18:06 -0800
    • Engine revision 6ed357c8b3
    • Dart version 2.12.0 (build 2.12.0-74.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/pedromassango/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.9.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] IntelliJ IDEA Community Edition (version 2020.2.3)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin version 51.0.3
    • Dart plugin version 202.8070

[✓] VS Code (version 1.51.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.16.0

[✓] Connected device (4 available)
    • sdk gphone x86 arm (mobile) • emulator-5554 • android-x86    • Android 11 (API 30) (emulator)
    • macOS (desktop)             • macos         • darwin-x64     • Mac OS X 10.15.7 19H2 darwin-x64
    • Web Server (web)            • web-server    • web-javascript • Flutter Tools
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 86.0.4240.198

• No issues found!
@pedromassangocode pedromassangocode changed the title AppLifeCycleState.detached is not called AppLifeCycleState.detached is not called when app is closed quickly Nov 25, 2020
@HamzaMihfad
Copy link

@HamzaMihfad HamzaMihfad commented Nov 25, 2020 •

I have the same issue, I tested it in to physical phones
-Redmi Note9 Pro with android 10:

I/flutter ( 4856): AppLifecycleState.inactive
I/flutter ( 4856): AppLifecycleState.paused
I/flutter ( 4856): AppLifecycleState.detached
Lost connection to device.

-Samsung j7 prime with android 8:

I/flutter ( 7847): AppLifecycleState.inactive
I/flutter ( 7847): AppLifecycleState.paused
Lost connection to device.

I think it depends on the android version

@rc8marcelo
Copy link

@rc8marcelo rc8marcelo commented Dec 15, 2020

I've tested this on iOS Simulators and an iPhone 6 running iOS 12 and detached isn't being called but inactive is. On Android 10 Poco F2 Pro the detached event is being called.

@kleytonstn
Copy link

@kleytonstn kleytonstn commented Feb 10, 2021

I have the same issue. Any updates?

@uzairleo
Copy link

@uzairleo uzairleo commented Feb 22, 2021

@haroonkhan9426
check this

@abhin-vicks
Copy link

@abhin-vicks abhin-vicks commented Mar 24, 2021

Any update on this? Or is there any other way in Flutter to execute a code(say calling a REST API) just before the app is swiped off(detached)?

@iapicca
Copy link
Contributor

@iapicca iapicca commented Mar 24, 2021 •

@pedromassangocode
the issue persists with the latest master and with sound null safety,
(do you mind updating the labels)

code sample
import 'package:flutter/material.dart';

void main() => runApp(const MaterialApp(home: MyHomePage()));

class MyHomePage extends StatefulWidget {
  const MyHomePage() : super(key: const ValueKey('MyHomePage'));

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with WidgetsBindingObserver {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance?.addObserver(this);
  }

  @override
  void dispose() {
    WidgetsBinding.instance?.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) => print(state);

  @override
  Widget build(BuildContext context) => Material(
        child: WillPopScope(
          onWillPop: () async => true,
          child: const Center(child: FlutterLogo(size: 80)),
        ),
      );
}
pubspec
name: issue
description: A new Flutter project.
version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:
  uses-material-design: true
doctor
[✓] Flutter (Channel master, 2.1.0-13.0.pre.232, on Linux, locale en_US.UTF-8)
    • Flutter version 2.1.0-13.0.pre.232 at /home/francesco/snap/flutter/common/flutter
    • Framework revision 9f49181f40 (2 hours ago), 2021-03-24 15:46:09 +0800
    • Engine revision d59a01d2d3
    • Dart version 2.13.0 (build 2.13.0-150.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /home/francesco/Android/Sdk
    • Platform android-30, build-tools 30.0.2
    • ANDROID_SDK_ROOT = /home/francesco/Android/Sdk
    • Java binary at: /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~20.04-b08)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /snap/bin/chromium

[✓] Linux toolchain - develop for Linux desktop
    • clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    • cmake version 3.10.2
    • ninja version 1.8.2
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (3 available)
    • Pixel 3a (mobile) • 965AY0WP5C • android-arm64  • Android 11 (API 30)
    • Linux (desktop)   • linux      • linux-x64      • Linux
    • Chrome (web)      • chrome     • web-javascript • Chromium 89.0.4389.90 snap

! Doctor found issues in 1 category.
logs
[  +90 ms] Syncing files to device Pixel 3a...
[   +1 ms] <- reset
[        ] Compiling dart to kernel with 0 updated files
[   +1 ms] <- recompile package:issue/main.dart 3f5b1d7c-f7d2-4863-8449-5e54397a0088
[        ] <- 3f5b1d7c-f7d2-4863-8449-5e54397a0088
[  +85 ms] Updating files.
[        ] DevFS: Sync finished
[   +1 ms] Syncing files to device Pixel 3a... (completed in 89ms)
[        ] Synced 0.0MB.
[        ] <- accept
[  +17 ms] Connected to _flutterView/0x77f3fbf6f0.
[   +2 ms] Flutter run key commands.
[   +1 ms] r Hot reload. 🔥🔥🔥
[        ] R Hot restart.
[        ] h Repeat this help message.
[        ] d Detach (terminate "flutter run" but leave application running).
[        ] c Clear the screen
[        ] q Quit (terminate the application on the device).
[        ] 💪 Running with sound null safety 💪
[        ] An Observatory debugger and profiler on Pixel 3a is available at: http://127.0.0.1:33431/1KxSGzo4wGQ=/
[ +754 ms] Activating Dart DevTools...
[+2330 ms] Activating Dart DevTools... (completed in 2,330ms)
[ +659 ms] The Flutter DevTools debugger and profiler on Pixel 3a is available at: http://127.0.0.1:9101?uri=http%3A%2F%2F127.0.0.1%3A33431%2F1KxSGzo4wGQ%3D%2F
[+21976 ms] I/flutter (17372): AppLifecycleState.inactive
[ +764 ms] I/flutter (17372): AppLifecycleState.paused
[   +9 ms] I/flutter (17372): AppLifecycleState.detached
[  +29 ms] E/libEGL  (17372): call to OpenGL ES API with no current context (logged once per thread)
[+8635 ms] I/flutter (17372): AppLifecycleState.inactive
[ +145 ms] I/flutter (17372): AppLifecycleState.paused
[ +853 ms] Service protocol connection closed.
[        ] Lost connection to device.
[   +2 ms] executing: /home/francesco/Android/Sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +5 ms] Exit code 0 from: /home/francesco/Android/Sdk/platform-tools/adb -s 965AY0WP5C forward --list
[        ] 965AY0WP5C tcp:40587 tcp:38771
[   +1 ms] executing: /home/francesco/Android/Sdk/platform-tools/adb -s 965AY0WP5C forward --remove tcp:40587
[   +8 ms] DevFS: Deleting filesystem on the device (file:///data/user/0/com.example.issue/code_cache/issueTAFPVQ/issue/)
[ +257 ms] Ignored error while cleaning up DevFS: TimeoutException after 0:00:00.250000: Future not completed
[   +5 ms] executing: /home/francesco/Android/Sdk/platform-tools/adb -s 965AY0WP5C forward --list
[  +21 ms] Exit code 0 from: /home/francesco/Android/Sdk/platform-tools/adb -s 965AY0WP5C forward --list
[   +5 ms] "flutter run" took 125,130ms.
[ +168 ms] ensureAnalyticsSent: 162ms
[   +5 ms] Running shutdown hooks
[   +1 ms] Shutdown hooks complete
[   +2 ms] exiting with code 0

[...] is there any other way in Flutter to execute a code(say calling a REST API) just before the app is swiped off(detached)?

@abhin-vicks
you may want to ask this question on stackoverflow,discord, reddit or slack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
10 participants