Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place Picker takes 11 seconds to load on IOS #43

Closed
amirhabibz opened this issue Jun 4, 2020 · 12 comments
Closed

Place Picker takes 11 seconds to load on IOS #43

amirhabibz opened this issue Jun 4, 2020 · 12 comments
Labels
question Further information is requested

Comments

@amirhabibz
Copy link

amirhabibz commented Jun 4, 2020

Describe the bug
When I use the Place Picker on an IOS 8 device it takes 11 seconds to load google maps. When I do this on the Android simulator it takes a few seconds for it to load.

To Reproduce
Loads the feature on an IOS device.

Expected behavior
I expected it to behave similar to the Android simulator

Screenshots
If applicable, add screenshots to help explain your problem.

Flutter Doctor -v
[✓] Flutter (Channel stable, v1.17.1, on Mac OS X 10.15.3 19D76, locale en-CA)
• Flutter version 1.17.1 at /Users/****/Development/flutter
• Framework revision f7a6a7906b (3 weeks ago), 2020-05-12 18:39:00 -0700
• Engine revision 6bc433c6b6
• Dart version 2.8.2

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/****/Library/Android/sdk
• Platform android-29, build-tools 29.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit visit
https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4, Build version 11E146
• CocoaPods version 1.9.0

[✓] Android Studio (version 3.6)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.45.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.10.2

[✓] Connected device (2 available)
• AOSP on IA Emulator • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• iPhone • ios • iOS 13.4.1

! Doctor found issues in 1 category.

@fysoul17
Copy link
Owner

fysoul17 commented Jun 4, 2020

Hi,
It is duplicated to #26 , but there weren't any further updates regarding it.

Can you share the code of PlacePicker widget settings?
Also, would you mind testing on another device or iPhone simulator as it did not happen on my side, and so I am unsure what is causing to your case.

@fysoul17 fysoul17 added the question Further information is requested label Jun 4, 2020
@amirhabibz
Copy link
Author

amirhabibz commented Jun 4, 2020

void showPlacePicker() async {
       Navigator.push(
        context,
        MaterialPageRoute(
          builder: (context) => PlacePicker(
            apiKey: "************",
            useCurrentLocation: true,
            usePlaceDetailSearch: true,
            onPlacePicked: (result) {
              setState(() {
                selectedPlace = result;
                locationController.text = result.name != null ? result.name : result.formattedAddress;
                print(result.name);
                var encoded = Geohash.encode(result.geometry.location.lat,result.geometry.location.lng);
                print(encoded);
              });
              Navigator.of(context).pop();
              setState(() {});
            },
          ),
        ),
      );
    }

I'll try testing on another device as well.

This is what I see on my xcode logs if it helps:
locationManager:didUpdateLocations:
[CurrentLocationTask dealloc]
[LocationTask dealloc] - This take 11 sec to showup

@amirhabibz
Copy link
Author

amirhabibz commented Jun 4, 2020

I just noticed that when i move the cursor to select a place and then want to go back to my current location, I have to wait 10-11 second before the current location button functions.

@amirhabibz
Copy link
Author

On the IOS simulator it doesn't go past the loading screen, I wasn't able to test on a different IOS phone. This is the best place picker library at the moment but the delay makes this unusable for me. I'm going to have to use another library for the time being.

@geekhenno
Copy link

this delay because the default of desired accuracy is high, other libraries we can change it from high to medium, but here we can not.

@fysoul17
Copy link
Owner

Hi, @hennonoman
Good to hear what was causing the issue.

Fortunately, we have a parameter called [desiredLocationAccuracy] which you can set the desired accuracy.

@amirhabibz, could you try changing the accuracy setting and check if it works?

@amirhabibz
Copy link
Author

@hennonoman @fysoul17 Thanks guys! This worked. I'm glad I can use this Library again.

Cheers!

@fysoul17
Copy link
Owner

Closing as the issue has been solved.

@SmarterVision
Copy link
Contributor

Hello @fysoul17 @amirhabibz, I still have the problem of 10 seconds to load the current location on IOS
can please let me know what you change to fix it

@martin-braun
Copy link
Contributor

martin-braun commented Feb 1, 2022

@SmarterVision For now, check my fork, this might work out with you. Things will probably take a while until they are fixed here. No offensive towards the author though, he is just too busy right now.

@gsoykan
Copy link

gsoykan commented Feb 24, 2022

Hi all, I've been facing with the same issue for long time. But in the end I was able to find out the primary reason why this takes long for me and finally found a solution for that.
The first thing I realized that was the map was loading slowly only when I enabled "useCurrentLocation".
Then I did little bit of research and realized that currentLocation actually comes from "geolocator" package which also suffers from the same slowness issue when getting the current location until a very recent version 8.2.0.
However, place picker as it is depends on geolocators 7th version in comparison to @martin-braun 's package which depends on ^8.0.0.
So solution: Change to @martin-braun 's fork and add geolocator: ^8.2.0 to your pubspec.yaml.

@martin-braun
Copy link
Contributor

@gsoykan Thank you. My new version 2.0.0-mb.14 is up. It should be fixed without the need of a more recent geolocator package in your pubspec.yaml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants