diff --git a/lib/main_screen.dart b/lib/main_screen.dart index 5804ba2..7b9d7be 100644 --- a/lib/main_screen.dart +++ b/lib/main_screen.dart @@ -72,7 +72,7 @@ class _MainScreenState extends State { FilledButton.tonal( onPressed: () async { try { - await bg.BackgroundGeolocation.getCurrentPosition(samples: 1); + await bg.BackgroundGeolocation.getCurrentPosition(samples: 1, persist: true); await bg.BackgroundGeolocation.sync(); } catch (error) { developer.log('Failed to fetch location', error: error); diff --git a/lib/quick_actions.dart b/lib/quick_actions.dart index f8d3bb4..2a7590a 100644 --- a/lib/quick_actions.dart +++ b/lib/quick_actions.dart @@ -27,7 +27,7 @@ class _QuickActionsInitializerState extends State { bg.BackgroundGeolocation.stop(); case 'sos': try { - await bg.BackgroundGeolocation.getCurrentPosition(samples: 1, extras: {'alarm': 'sos'}); + await bg.BackgroundGeolocation.getCurrentPosition(samples: 1, persist: true, extras: {'alarm': 'sos'}); await bg.BackgroundGeolocation.sync(); } catch (error) { developer.log('Failed to send alert', error: error);