stub
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
**/*.sw*
|
||||
26
cmd/app/main.dart
Normal file
26
cmd/app/main.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:location/location.dart';
|
||||
|
||||
Location location = Location();
|
||||
location.enableBackgroundMode(enable: true)
|
||||
|
||||
bool serviceEnabled;
|
||||
PermissionStatus permissionGranted;
|
||||
LocationData locationData;
|
||||
|
||||
serviceEnabled = await location.serviceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
serviceEnabled = await location.requestService();
|
||||
if (!serviceEnabled) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
permissionGranted = await location.hasPermission();
|
||||
if (permissionGranted == PermissionStatus.denied) {
|
||||
permissionGranted = await location.requestPermission();
|
||||
if (permissionGranted != PermissionStatus.granted) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
locationData = await location.getLocation();
|
||||
2
permissions.android.todo
Normal file
2
permissions.android.todo
Normal file
@@ -0,0 +1,2 @@
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
2
pubspec.yaml.todo
Normal file
2
pubspec.yaml.todo
Normal file
@@ -0,0 +1,2 @@
|
||||
dependencies:
|
||||
location: ^5.0.0
|
||||
Reference in New Issue
Block a user