flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

On flutter web in IOS browsers not working any thing

Open mohamadkenway opened this issue 3 years ago • 17 comments

On flutter web in IOS browsers not working any thing

mohamadkenway avatar Jul 26 '22 09:07 mohamadkenway

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 -v command.
  • Version of the plugin used.

mvanbeusekom avatar Jul 26 '22 09:07 mvanbeusekom

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

mohamadkenway avatar Jul 26 '22 14:07 mohamadkenway

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 -v command.
  • Version of the plugin used.

Do you need more info ? Just test on iPhones

mohamadkenway avatar Jul 27 '22 14:07 mohamadkenway

is there any solution ?

mohamadkenway avatar Jul 30 '22 16:07 mohamadkenway

I'm still looking for solution

mohamadkenway avatar Aug 04 '22 15:08 mohamadkenway

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?

florissmit1 avatar Aug 05 '22 08:08 florissmit1

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?

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

mohamadkenway avatar Aug 05 '22 16:08 mohamadkenway

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

mohamadkenway avatar Aug 05 '22 16:08 mohamadkenway

try building the web app with --web-renderer canvaskit

tyler-jewell avatar Aug 16 '22 19:08 tyler-jewell

I'm seeing the same issue.

Here are my repro steps:

  1. setup and run the example code
  2. deploy to github pages
  3. open in chrome on iphone
  4. verify not working

I added some log messages:

serviceEnabled true
permission LocationPermission.unabledToDetermine

fredells avatar Aug 21 '22 22:08 fredells

@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

fredells avatar Aug 21 '22 23:08 fredells

@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

No my problem is bigger than this, on some iphone browsers it's working but in some not working

mohamadkenway avatar Aug 22 '22 17:08 mohamadkenway

@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

may be you test it in other iphones , it will not work

mohamadkenway avatar Aug 22 '22 17:08 mohamadkenway

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.

avinashk369 avatar Sep 21 '22 13:09 avinashk369

I'm facing this issue too, ios users can't get location on safari even with location on

prologikus avatar Mar 22 '23 23:03 prologikus

Hello, I also encountered the same problem, has anyone found a solution?

behi1ty avatar May 24 '23 23:05 behi1ty

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.

reke592 avatar Jan 15 '24 03:01 reke592