2021-11-15 14:29:31 +00:00
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
|
|
|
class AppLifecycleService {
|
|
|
|
final _logger = Logger("AppLifecycleService");
|
|
|
|
|
|
|
|
bool isForeground = false;
|
|
|
|
|
|
|
|
static final AppLifecycleService instance =
|
|
|
|
AppLifecycleService._privateConstructor();
|
|
|
|
|
|
|
|
AppLifecycleService._privateConstructor();
|
|
|
|
|
2022-03-07 20:18:50 +00:00
|
|
|
void onAppInForeground(String reason) {
|
|
|
|
_logger.info("App in foreground via $reason");
|
2021-11-15 14:29:31 +00:00
|
|
|
isForeground = true;
|
|
|
|
}
|
|
|
|
|
2022-03-07 20:18:50 +00:00
|
|
|
void onAppInBackground(String reason) {
|
|
|
|
_logger.info("App in background $reason");
|
2021-11-15 14:29:31 +00:00
|
|
|
isForeground = false;
|
|
|
|
}
|
|
|
|
}
|