flutter-plugins icon indicating copy to clipboard operation
flutter-plugins copied to clipboard

[Health 10.2.0] Incompatible with predictive back on Android 13/14

Open ciriousjoker opened this issue 8 months ago • 1 comments

Device / Emulator and OS

Please complete the following information for each phone and/or emulator you're experiencing this bug on:

  • Device: Pixel 8 simulator
  • OS: Android 14

Describe the bug

One requirement to use this plugin is to extend FlutterFragmentActivity instead of FlutterActivity. Is there anyway to remove the need to extend FlutterFragmentActivity?

This is a problem because it breaks predictive back:

  • User presses back and the app is put in the background, instead of the route being popped

FlutterActivity supports predictive back, but FlutterFragmentActivity currently doesn't. Related issues:

  • https://github.com/flutter/flutter/issues/117061
  • https://github.com/flutter/flutter/issues/109558

To Reproduce

  1. Run any flutter app with a navigator and a overview/detail screen model
  2. Add android:enableOnBackInvokedCallback="true" to the activity tag in AndroidManifest.xml
  3. Run the app, navigate to another screen
  4. Press the system back button (or do the gesture)

Expected behavior

App should stay open, user should be pushed back to the overview screen.

Actual behavior

App closes.

Screenshots

n/a

Flutter doctor

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.19.1, on macOS 14.5 23F79 darwin-arm64, locale de-DE) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.3) [✓] Chrome - develop for the web [✓] Android Studio (version 2023.3) [✓] VS Code (version 1.89.1) [✓] Connected device (2 available) [✓] Network resources

• No issues found!

Additional information

Also happens in newer Flutter versions, ie 3.22.1 (newest at the time of writing).

ciriousjoker avatar May 29 '24 17:05 ciriousjoker