didChangeAppLifecycleState method

  1. @override
Future<void> didChangeAppLifecycleState(
  1. AppLifecycleState state
)
override

Unregisters location updates when the app is paused, hidden or detached.

Implementation

@override
Future<void> didChangeAppLifecycleState(AppLifecycleState state) async {
  switch (state) {
    case AppLifecycleState.paused:
    case AppLifecycleState.hidden:
    case AppLifecycleState.detached:
      await AdvancedBackgroundLocator.unRegisterLocationUpdate();
    case AppLifecycleState.inactive:
    // Inactive is also reported for transient interruptions (calls, control center).
    case AppLifecycleState.resumed:
      break;
  }
}