Baseflow / Baseflow/flutter-geolocator

[Bug]: Fake Location problem when calling getCurrentPosition and getLastKnownPosition

Open
#1,749 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
1.3k
Forks
803
Avg merge
8h 16m
Merged PRs (30d)
1

Description

### Please check the following before submitting a new issue.

- [x] I have searched the [existing issues](https://github.com/baseflow/flutter-geolocator/issues).
- [x] I have carefully [read the documentation](https://github.com/Baseflow/flutter-geolocator/blob/main/geolocator/README.md) and verified I have added the required platform specific configuration.

### Please select affected platform(s)

- [x] Android
- [ ] iOS
- [ ] Linux
- [ ] macOS
- [ ] Web
- [ ] Windows

### Steps to reproduce

Enable any fake location provider then
Running [Geolocator.getCurrentPosition] or [Geolocator.getLastKnownPosition] in a background isolate
my case was foreground service isolate

[Geolocator.getCurrentPosition] throws
Unhandled Exception: ParallelWaitError: The location service on the device is disabled.
also the location service is enabled

[Geolocator.getCurrentPosition] throws
[ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: Lookup failed: getLastKnownPosition in @methods in LocationService in package:dawami/core/services/location/location_service.dart

all these function works well in the main isolate and the background service isolate unless I put a fake GPS locati
but all

### Expected results

To work like the main isolate

### Actual results

When enabling fake location app throws exceptions when getting location in background isolates

### Code sample

Code sample

```dart
[Paste your code here]
```

### Screenshots or video

Screenshots or video demonstration

[Upload media here]

### Version

14.0.2

### Flutter Doctor output

Doctor output

```console
[Paste your output here]
```

Contributor guide

Open the contributing guide

Research direction

Start with the Geolocator.getCurrentPosition and Geolocator.getLastKnownPosition entry points and the Android background-isolate behavior described in the report. Reproduce with a fake location provider in the main and foreground-service isolates; done means both calls work in the background as they do in the main isolate without the reported exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.