Skip to content

MethodChannel invokeMethod does not work in Detached state #65538

@afung2468

Description

@afung2468

Steps to Reproduce

  1. Create an app which uses a Dart Package using MethodChannel to call kotlin codes.
  2. Add a Log.i statement in onMehodCall to verify that the kotlin codes are executed.
    3 Use didChangeAppLifecycleState to monitor state changes.
  3. Call the channleMethod in the following states: inactive, paused and detached.
  4. Quit the app in Recent Apps.
  5. You will observed kotlin codes (onMethodCall) are executed in inactive state but not in paused and detached states.

I need to be able to call channelMethods in detached state to unbind foreground service to prevent memory leak. I am using flutter_background_location package which has a foreground service. How would you unbind the service at detached state when channelMethods do not work?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: pluginsSupport for writing, building, and running plugin packagesengineflutter/engine related. See also e: labels.found in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-androidAndroid applications specificallyteam-androidOwned by Android platform teamtriaged-androidTriaged by Android platform team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions