flutter-geolocator
flutter-geolocator copied to clipboard
On flutter web in IOS browsers not working any thing
On flutter web in IOS browsers not working any thing
If you'd like us to help you, help us by providing detailed information:
- Clear description on what you have tried.
- Code samples (preferable an example app demonstrating the behavior).
- Output of
flutter doctor -vcommand. - Version of the plugin used.
in flutter web await Geolocator.getCurrentPosition(); not out the result and this happen in some browsers not all browsers for example it works in chrome browser and not working in firefox browser or safari check it out on an apple iphone mobile
version : geolocator-9.0.1 geolocator_web-2.1.6
also "location" package have same problem for me
[✓] Flutter (Channel stable, 3.0.5, on Linux Mint 20.2 5.4.0-88-generic, locale en_US.UTF-8) • Flutter version 3.0.5 at /home/edward/sdks/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision f1875d570e (13 days ago), 2022-07-13 11:24:16 -0700 • Engine revision e85ea0e79c • Dart version 2.17.6 • DevTools version 2.12.2
[!] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /home/edward/Android/Sdk
• Platform android-33, build-tools 31.0.0
• Java binary at: /home/edward/Downloads/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for more details.
[✓] Chrome - develop for the web • Chrome at google-chrome
[✗] Linux toolchain - develop for Linux desktop ✗ clang++ is required for Linux development. It is likely available from your distribution (e.g.: apt install clang), or can be downloaded from https://releases.llvm.org/ • cmake version 3.16.3 ✗ ninja is required for Linux development. It is likely available from your distribution (e.g.: apt install ninja-build), or can be downloaded from https://github.com/ninja-build/ninja/releases • pkg-config version 0.29.1 ✗ GTK 3.0 development libraries are required for Linux development. They are likely available from your distribution (e.g.: apt install libgtk-3-dev)
[✓] Android Studio (version 2021.2) • Android Studio at /home/edward/Downloads/android-studio • Flutter plugin version 69.0.2 • Dart plugin version 212.5744 • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code (version 1.63.2) • VS Code at /usr/share/code • Flutter extension version 3.36.0
[✓] Connected device (3 available) • Samsung (mobile) • 192.168.60.101:5555 • android-x86 • Android 8.0.0 (API 26) • Linux (desktop) • linux • linux-x64 • Linux Mint 20.2 5.4.0-88-generic • Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.114
[✓] HTTP Host Availability • All required HTTP hosts are available
If you'd like us to help you, help us by providing detailed information:
- Clear description on what you have tried.
- Code samples (preferable an example app demonstrating the behavior).
- Output of
flutter doctor -vcommand.- Version of the plugin used.
Do you need more info ? Just test on iPhones
is there any solution ?
I'm still looking for solution
Hey @mohamadkenway, can you tell me if your application is served in a secure context or not? When using a unsecure context (HTTP) instead of a secure context (HTTPS) the getCurrentPosition method will not work on some browsers. If you're using a secure context, can you post a code sample for me, so that I can reproduce your issue?
Hey @mohamadkenway, can you tell me if your application is served in a secure context or not? When using a unsecure context (HTTP) instead of a secure context (HTTPS) the
getCurrentPositionmethod will not work on some browsers. If you're using a secure context, can you post a code sample for me, so that I can reproduce your issue?
Yes I'm deployed on HTTPS server My code has no problem , because it works in some Chrome IOS browsers and it is OK in android browsers
My Suggestion is that we implement GPS in js platform channel But i tried and it's not work Probably i can't implement native js correctly
try building the web app with --web-renderer canvaskit
I'm seeing the same issue.
Here are my repro steps:
- setup and run the example code
- deploy to github pages
- open in chrome on iphone
- verify not working
I added some log messages:
serviceEnabled true
permission LocationPermission.unabledToDetermine
@mohamadkenway okay i was able to resolve my issue. I needed to enable Settings > Privacy > Location Services on my iPhone. I added a prompt for users to do this when location could not be determined
@mohamadkenway okay i was able to resolve my issue. I needed to enable
Settings > Privacy > Location Serviceson my iPhone. I added a prompt for users to do this when location could not be determined
No my problem is bigger than this, on some iphone browsers it's working but in some not working
@mohamadkenway okay i was able to resolve my issue. I needed to enable
Settings > Privacy > Location Serviceson my iPhone. I added a prompt for users to do this when location could not be determined
may be you test it in other iphones , it will not work
I would say this package alone is not responsible for weird behaviour when you request for location on safari browser. I checked multiple web apps which works based on user location, even those web apps are not able to get the location on safari browser. Even i am looking for the solution to get the user location on safari browser, i tried JS package with Mozilla Geolocation api but it didn't work as well.
I'm facing this issue too, ios users can't get location on safari even with location on
Hello, I also encountered the same problem, has anyone found a solution?
Not sure if this issue is still active, but we encountered this kind of error before. Some iOS versions don't have the navigator.permissions.query. The interim solution that worked for us is to create an import stub for web build to check the object in js.context before requesting the permission.