Closed jean-gblr closed 2 years ago
Which version are you trying?
Hey,
When I wrote the issue I was using flutter_map_location_marker: ^2.0.0
Do you still facing this problem in v3?
We are not having the exception per se anymore, using v3. But the location still does not center.
What we did to fix the issue, was using the determinePermission from the geolocator package to prompt user to allow location.
`Future
// Test if location services are enabled.
serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
// Location services are not enabled don't continue
// accessing the position and request users of the
// App to enable the location services.
return Future.error('Location services are disabled.');
}
permission = await Geolocator.checkPermission();
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
// Permissions are denied, next time you could try
// requesting permissions again (this is also where
// Android's shouldShowRequestPermissionRationale
// returned true. According to Android guidelines
// your App should show an explanatory UI now.
return Future.error('Location permissions are denied');
}
}
if (permission == LocationPermission.deniedForever) {
// Permissions are denied forever, handle appropriately.
return Future.error(
'Location permissions are permanently denied, we cannot request permissions.');
}
// When we reach here, permissions are granted and we can
// continue accessing the position of the device.
return true;
}`
According to this post, the permission and location service are handled internally inside geolocator
. Can you provide more code to reproduce this issue?
Yes I am aware of this post, this is actually what lead us to think about calling this function ourselves.
As for an example code project, I just tried today using the example app in your repo. I launched the app with an android simulator and a route, the app is not centering.
From v2, we are not seeing the exception anymore, but it still does not work as expected.
What do you mean the app is not centering?
Have you checked the location permission in the settings application in the emulator?
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.
Hello,
I've been trying to use this plugin in my app unsuccessfully. So in order to get my work out of the way I cloned the repo and tried the examples here.
I have not been able to use the location on ios emulator, real iphone and android emulator (that I tried)
I always get the exception below
Now I know the exception seem to come from the geolcator package, but I've cloned their repo and their example seem to work fine.
What I saw was different is when running the flutter_map_location_marker example, the app did not ask my permission for location use, so maybe it's linked ? Whereas in the Geolocator app, I do get a popup asking for it.
If anyone has an idea on what to do, would be great :D
`Connecting to VM Service at ws://127.0.0.1:60321/O8ZOImZrVMM=/ws fopen failed for data file: errno = 2 (No such file or directory) Errors found! Invalidating cache... LOCATION UPDATE FAILURE:Error reason: (null)Error description: The operation couldn’t be completed. (kCLErrorDomain error 1.) [VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: The operation couldn’t be completed. (kCLErrorDomain error 1.)
0 MethodChannelGeolocator.getPositionStream.
package:geolocator_platform_interface/…/implementations/method_channel_geolocator.dart:188
1 _invokeErrorHandler (dart:async/async_error.dart:45:24)
2 _HandleErrorStream._handleError (dart:async/stream_pipe.dart:269:9)
3 _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:157:13)
4 _rootRunBinary (dart:async/zone.dart:1452:47)
5 _CustomZone.runBinary (dart:async/zone.dart:1342:19)
6 _CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
7 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
8 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
9 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
10 _ForwardingStreamSubscription._addError (dart:async/stream_pipe.dart:128:11)
11 _ForwardingStream._handleError (dart:async/stream_pipe.dart:95:10)
12 _ForwardingStreamSubscription._handleError (dart:async/stream_pipe.dart:157:13)
13 _rootRunBinary (dart:async/zone.dart:1452:47)
14 _CustomZone.runBinary (dart:async/zone.dart:1342:19)
15 _CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
16 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
17 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
18 _BufferingStreamSubscription._addError (dart:async/stream_impl.dart:280:7)
19 _SyncBroadcastStreamController._sendError. (dart:async/broadcast_stream_controller.dart:393:20)
20 _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:323:15)
21 _SyncBroadcastStreamController._sendError (dart:async/broadcast_stream_controller.dart:392:5)
22 _AsBroadcastStreamController.addError (dart:async/broadcast_stream_controller.dart:487:5)
23 _rootRunBinary (dart:async/zone.dart:1452:47)
24 _CustomZone.runBinary (dart:async/zone.dart:1342:19)
25 _CustomZone.runBinaryGuarded (dart:async/zone.dart:1252:7)
26 _BufferingStreamSubscription._sendError.sendError (dart:async/stream_impl.dart:360:15)
27 _BufferingStreamSubscription._sendError (dart:async/stream_impl.dart:378:7)
28 _DelayedError.perform (dart:async/stream_impl.dart:602:14)
29 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11)
30 _PendingEvents.schedule. (dart:async/stream_impl.dart:663:7)
31 _rootRun (dart:async/zone.dart:1420:47)
32 _CustomZone.run (dart:async/zone.dart:1328:19)
33 _CustomZone.runGuarded (dart:async/zone.dart:1236:7)
34 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1276:23)
35 _rootRun (dart:async/zone.dart:1428:13)
`