Comments (2)
It seems a delay makes it work! am trying to find workaround about that
LocationListener() async {
if (locationListener != null)
return;
Future.delayed(
const Duration(seconds: 5),
() {
print('setting up new listener ${locationListener != null}');
locationListener = location.onLocationChanged
.handleError(handleError)
.listen((LocationData currentLocation) {
print('Position' + currentLocation.latitude.toString());
Backpack.instance.set('Position', currentLocation);
});
},
);
}
from flutterlocation.
ok i got it !
await location.getLocation();
adding this line before onLocationChanged
will make it work
I assume this line have ability to know if the hardware is ready after enabling while onLocationChanged
lack of that
LocationListener() async {
if (locationListener != null) return;
await location.getLocation(); // workaround fix late location serviceissue
locationListener = location.onLocationChanged
.handleError(handleError)
.listen((LocationData currentLocation) {
print('Position' + currentLocation.latitude.toString());
Backpack.instance.set('Position', currentLocation);
});
}
from flutterlocation.
Related Issues (20)
- Compatibility with Gradle 8 HOT 2
- Incorrect behavior getLocation HOT 2
- Issue between location: ^5.0.3 and Kotlin 1.9.0 HOT 3
- Android version 5
- without internet
- Unable to Built Flutter App [ sdk: '>=3.2.3 <4.0.0' ] HOT 1
- Flutter Android Phone error HOT 1
- Kotlin version 1.9.0 HOT 1
- Background geolocation has not worked since Android version 13 HOT 6
- Heading feature shows wrong values.... HOT 1
- How to disable notifications while running in the background HOT 1
- Kotlin version 1.8.0 and Flutter version 1.19.0 HOT 11
- Notification not showing properly, always default
- Background location indicator is always shown on iOS >= 11.0
- Fetching Incorrect Location for tablet Devices
- location_web: migrate from `package:js` to `package:js_interop` HOT 3
- location: ^6.0.0 is incompatible with latest firebase_core: ^2.27.2 HOT 2
- The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher. HOT 3
- PlatformException(UNEXPECTED_ERROR, 17: API: LocationServices.API is not available on this device. Connection failed with: b{statusCode=SERVICE_INVALID, resolution=null, message=null}, null, null)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutterlocation.