How to end live activity when app terminated flutter

266 views Asked by At

I was trying to implement live activities to my project. I successfully managed that but can't kill the live activities when app terminated. I tried to end the live activity like this:

case AppLifecycleState.detached:
    LiveActivitiesManager().endLiveActivity();

As far as I understand, when user terminated the the app state = detached.However, when app gets terminated live activity's end functionality does not work. If I put this functionality to random button in my app, it works perfectly fine but not when the applifecycle state is detached.How can I solve this problem? I'm using this package plugin for live activities: https://pub.dev/packages/flutter_live_activities

0

There are 0 answers