finished tracking. But not tested enough yet
time
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import 'package:fforte/screens/addCam/exceptions/location_disabled_exception.dart';
|
||||
import 'package:fforte/screens/addCam/exceptions/location_forbidden_exception.dart';
|
||||
import 'package:fforte/screens/excursion/exceptions/need_always_location_exception.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
|
||||
class GeolocatorService {
|
||||
// determine live position with checks for denied permission and turned off location service
|
||||
static Future<Position> deteterminePosition() async {
|
||||
static Future<Position> deteterminePosition({bool alwaysOnNeeded = false}) async {
|
||||
bool locationEnabled;
|
||||
LocationPermission permissionGiven;
|
||||
|
||||
@@ -20,6 +21,10 @@ class GeolocatorService {
|
||||
throw LocationForbiddenException();
|
||||
}
|
||||
}
|
||||
|
||||
if (alwaysOnNeeded && permissionGiven != LocationPermission.always) {
|
||||
throw NeedAlwaysLocation();
|
||||
}
|
||||
|
||||
return await Geolocator.getCurrentPosition();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user