sendAppLifecycleState method
Implementation
void sendAppLifecycleState(AppLifecycleState state) {
// Handle specific states
switch (state) {
case AppLifecycleState.resumed:
SessionService().sessionStarted();
SessionService().sessionListPrint();
// App is visible and in the foreground
// Perform actions like resuming tasks, fetching data, or sending analytics
break;
case AppLifecycleState.inactive:
// App is inactive (e.g., a phone call or app switcher is open)
// Perform actions like pausing animations or saving unsaved work
break;
case AppLifecycleState.paused:
SessionService().sessionEnded();
SessionService().sessionListPrint();
break;
case AppLifecycleState.detached:
SessionService().sessionEnded();
SessionService().sessionListPrint();
// Perform cleanup actions like closing database connections or saving state
break;
case AppLifecycleState.hidden:
// TODO: Handle this case.
}
}