Skip to content

didChangeAppLifecycleState - different behaviour iOS vs Android #124591

@adamgic

Description

@adamgic

Method didChangeAppLifecycleState of WidgetsBindingObserver for iOS gets called reliably, for Android missing callbacks for entering App Switcher and App start.

Steps to Reproduce

  1. Execute flutter run on the code sample for Android device
  2. Wait for app to load on a screen
  3. Swipe from bottom to show App Switcher
  4. Tap App UI to go back to the app

Expected results:
didChangeAppLifecycleState function gets called as it is for iOS
(e.g. two calls - one with AppLifecycleState.inactive, one with AppLifecycleState.resumed parameter)

Actual results:
No calls to didChangeAppLifecycleState happen.
The same for App start - no calls to didChangeAppLifecycleState.

@gspencergoog could you please have a look?

Kind regards,
AG

Code sample
class _ScreenWidgetState extends State<ScreenWidget> with WidgetsBindingObserver {
  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);
  }

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

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) async {
  	...
  }
}
Logs

Metadata

Metadata

Assignees

Labels

P0Critical issues such as a build break or regressioncustomer: vroomframeworkflutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions