Replace paid flutter_background_geolocation with free flutter_foreground_task

Replace proprietary flutter_background_geolocation (requires paid license
for Android release builds) with free flutter_foreground_task package.
Background location tracking now uses foreground service with periodic
geolocation updates every 30 seconds.
This commit is contained in:
dmit.b
2026-06-25 13:24:24 +03:00
parent 5f59e17da8
commit 506608c508
6 changed files with 105 additions and 75 deletions
+2
View File
@@ -10,6 +10,7 @@ import '../providers/map_provider.dart';
import '../providers/share_provider.dart';
import '../services/geo_service.dart';
import '../services/background_geo_service.dart';
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
class MapScreen extends StatefulWidget {
const MapScreen({super.key});
@@ -77,6 +78,7 @@ class _MapScreenState extends State<MapScreen> {
token: authProvider.token,
geoId: shareProvider.geoId,
);
FlutterForegroundTask.setTaskHandler(BackgroundTaskHandler());
await bgGeo.start();
} catch (e) {
if (!mounted) return;