Baseflow / flutter-geolocator

Android and iOS Geolocation plugin for Flutter
https://baseflow.com/
MIT License
1.22k stars 631 forks source link

[Bug]: Issue with obtaining location on SM9550 #1379

Closed lvyandev closed 8 months ago

lvyandev commented 8 months ago

Please check the following before submitting a new issue.

Please select affected platform(s)

Steps to reproduce

Using the official demo on the device with all location permissions enabled, but unable to acquire location data.

Expected results

Accuracy: The application should accurately obtain the current geographical location of the device, including latitude and longitude. Timeliness: The retrieval of location information should be prompt, without significant delays. Consistency: The plugin should be able to continuously track changes in the device's location if the application requires it.

Actual results

This issue persists even though the app is authorized to access location data

Code sample

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

Screenshots or video

Screenshots or video demonstration [Upload media here] https://github.com/Baseflow/flutter-geolocator/assets/18045999/07dc50ad-1b97-407a-a211-d084cb433c70

Version

10.1.0

Flutter Doctor output

Doctor output ```console [✓] Flutter (Channel stable, 3.13.9, on macOS 14.0 23A344 darwin-arm64, locale zh-Hans-CN) • Flutter version 3.13.9 on channel stable at /Users/lvyan/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision d211f42860 (3 weeks ago), 2023-10-25 13:42:25 -0700 • Engine revision 0545f8705d • Dart version 3.1.5 • DevTools version 2.25.0 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/lvyan/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/lvyan/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.12.1 [✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) [✓] IntelliJ IDEA Community Edition (version 2023.2.2) • IntelliJ at /Applications/IntelliJ IDEA CE.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart [✓] VS Code (version 1.84.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.76.0 [✓] Proxy Configuration • HTTP_PROXY is set • NO_PROXY is localhost,127.0.0.1,::1 • NO_PROXY contains localhost • NO_PROXY contains 127.0.0.1 • NO_PROXY contains ::1 [✓] Connected device (1 available) • SM G9550 (mobile) • 9889db34513850504f • android-arm64 • Android 9 (API 28) ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac. The device must be opted into Developer Mode to connect wirelessly. (code -27) [✓] Network resources • All expected network resources are available. ```
TimHoogstrate commented 8 months ago

Dear @lvyandev,

Could you send me the LocationSettings that you use? It looks like you are using the GPS. Be careful then using GPS and testing indoors. It could be that the gps is unable to determine your position indoors.

Kind regards,

lvyandev commented 8 months ago

Dear @TimHoogstrate ,

Thank you very much for your response and support. I am encountering the issue while using the official demo version of the plugin. I have not made any modifications to the LocationSettings or any other settings in the demo code; I am running it exactly as provided by the official version.

Additionally, I have taken note of your mention regarding the potential inaccuracies of GPS in indoor settings. To add to this, I have observed that when using Baidu or Amap location SDKs, I can successfully acquire location data, even indoors. Similarly, another phone of mine using the same demo is also able to successfully locate indoors. I will attempt to test the application in an outdoor environment to see if there is a difference in performance. However, it's worth mentioning that the weather app on my phone is able to locate accurately.

Furthermore, I would like to mention that previously, in our project where we used version 9.0.2, this same device was able to successfully locate without any issues. This makes it challenging to pinpoint the specific cause of the current problem.

Looking forward to any further guidance you may have.

Best regards,

TimHoogstrate commented 8 months ago

Dear @lvyandev,

Location determination is a complex game between several different sensors e.g. wifi, 4g, gps and for example IP. GPS (or better GNSS) is the most accurate but also the most energy consuming. Therefore, the OS prevents using it as much as possible. You can force gps (as much as possible) by setting forceLocationManager = true in the locationSettings. I've tested with a Nexus 7 indoor, and my device saw 16 different satellites. Next day, same position it barely saw 7 satellites. In addition, different apps can play with different settings. Indoor, probably forceLocationManager = false performs better. But other settings like distance filters or accuracy also play a major role. What setting you could use in your application depends a lot on the goal of your app. I would suggest just to play around a bit to learn what happens when you use different settings.

Kind regards,

lvyandev commented 8 months ago

Thank you very much for sharing your valuable experience and insights. I have tried modifying the forceLocationManager setting, but it seems to have a minimal impact on the results. I will continue to observe and assess whether indoor conditions or other factors might be influencing this. Your guidance is greatly appreciated.

Thank you once again for your assistance.

TimHoogstrate commented 8 months ago

I'll close this issue for now. Feel free to reopen this ticket, or open a new ticket when new information pops-up.

Success with your project,