stub
commit
ba5f3f457f
|
|
@ -0,0 +1 @@
|
|||
**/*.sw*
|
||||
|
|
@ -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();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
dependencies:
|
||||
location: ^5.0.0
|
||||
Loading…
Reference in New Issue