'Activity Recognition in Background using Flutter

I want to implement activity recognition in background that means if user close the application even then it'll listening the activity recognition states whether it is in IN VEHICLE, STILL or in which state.

I already tried activity_recognition_flutter: ^4.2.0 package to implement this -> Everything is working fine except in background it is not working when I close the application.I want to implement it in Android & iOS both and my current focus is Android primarily.

Can anyone guide with his/her experience if he/she knows how to do it. Thank you !



Solution 1:[1]

Have you try passing BLoC events to flutter background? The idea is you can devine events in your BLoC and let flutter background do the job equals to what events it helds.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 normnd.akbr