Closed hungtran2492 closed 4 years ago
Experiencing same issue. Not found what's causing the slowdown so far but using Last Known Position as a temporary work around for my case...
check if your Info.plist have 3 keys
Same problem here. Had to downgrade to 4.0.3 version of geolocator plugin. Every version after that is very slow to respond in iOS. And yes, @paulobreim I have all the required strings in Info.plist, otherwise it would not respond at all.
I use Location plugin for getting the current location. It works fine on both Android and IOS.
@hungtran2492 I'm also using Location plugin, it's much faster than this.
@StijnWoerkom what's the reason for closing? This is a legitimate bug that is causing developers issues on the main locational library for Flutter.
@ollydixon I tested this issue on multiple IOS devices and concluded that the problem was more with the device than with the code. I can re-open the issue, but I don't see any trouble occurring with this issue.
@StijnWoerkom if it helps I did a live app demo with 4 users and it was slow on all their mobiles. (All iOS). Was a little embarrising for me cause the simulator works fine it's only on the device it's extremely slow.
I used another library and it was fine (Location for Flutter).
Version 4.0.3 works just fine. I actually downgraded to that version on my app. So it's got to be something in the library itself. Did tests with different iPhones, it's consistent, so I doubt it's the device.
@ollydixon Thank you for your response. I'm sorry for your failure with the demo. I re-opened the issue and will look further into this. Can you tell me what version you were using?
@StijnWoerkom no worries, they knew it was an alpha build. It was 5.1.3.
Any version after 4.0.3 has the problem. So it must be something introduced in 5.0.0.
@babaosoftware In the 5.0.0 version, we converted the IOS version from Swift to Objective-C, reducing the size of the final binary considerably, as well as solve some compatibility issues with other objective-c based plugins.
@StijnWoerkom I am not questioning the necessity of the conversion, just saying that it created this problem, and giving a hint to where someone might start looking into it.
I noticed that you told me yesterday that the problems started with version 5.0.0. I am looking into all the features we added with the version to determine what the cause of the issue is.
Let me suggest an alternative to isolating the problem, if it really exists. We can make a small program with the geolocator.getCurrentPosition function only, and everyone can test this program and measure the time it executes. what do you think?
@paulobreim I was going to do exactly that tonight (USA Eastern time). I will post my result as soon as I will have them.
I did the following test:
The app:
import 'package:flutter/foundation.dart';
import 'package:geolocator/geolocator.dart';
void main(){
DateTime start = DateTime.now();
getCurrentPosition().then((pos){
DateTime end = DateTime.now();
debugPrint("time span = ${end.difference(start).inMilliseconds} ms");
});
}
Future
in pubspec.yaml I have geolocator: ^4.0.3 # Don't upgrade - it's very slow to respond on startup. for the first test, and geolocator: ^5.1.4 for the second test. I tested using an iPhone 6S, but before I used newer devices too, so I don't think the device makes a difference. The first test, with version 4.0.3 showed a response time of about 100ms The second test, with version 5.1.4. showed a response time of about 10 s - that is seconds, not ms There you go.
I am trying to test it in my Motorola Z2 Play and an iPhone, but I got the error below and don know what to do.
Launching lib/main.dart on Android SDK built for x86 in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'...
FAILURE: Build failed with an exception.
Android dependency 'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.2) classpath. You should manually set the same version via DependencyResolution
I know there are no relations with geolocator, but i don know to fix it.
'androidx.core:core' has different version for the compile (1.0.0) and runtime (1.0.2) classpath
Check this: https://github.com/flutter/flutter/issues/27254
Here is my test for Android. I put a floatingActionButton and pressed 10 times
FIRST TEST geolocator: ^4.0.3 Launching lib/main.dart on Moto Z2 Play in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... Built build/app/outputs/apk/debug/app-debug.apk. Syncing files to device Moto Z2 Play... I/flutter (11197): time span = 1006 ms I/flutter (11197): time span = 1626 ms I/flutter (11197): time span = 965 ms I/flutter (11197): time span = 6024 ms I/flutter (11197): time span = 991 ms I/flutter (11197): time span = 971 ms I/flutter (11197): time span = 6022 ms I/zygote (11197): Do partial code cache collection, code=62KB, data=51KB I/zygote (11197): After code cache collection, code=62KB, data=51KB I/zygote (11197): Increasing code cache capacity to 256KB I/flutter (11197): time span = 7866 ms I/flutter (11197): time span = 940 ms I/flutter (11197): time span = 6091 ms
SECOND TEST geolocator: ^5.1.4 Launching lib/main.dart on Moto Z2 Play in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... Built build/app/outputs/apk/debug/app-debug.apk. Syncing files to device Moto Z2 Play... I/flutter (11471): time span = 1043 ms I/flutter (11471): time span = 5927 ms I/flutter (11471): time span = 8876 ms I/flutter (11471): time span = 1052 ms I/flutter (11471): time span = 5987 ms I/flutter (11471): time span = 6316 ms I/flutter (11471): time span = 5948 ms I/zygote (11471): Do partial code cache collection, code=62KB, data=50KB I/zygote (11471): After code cache collection, code=62KB, data=50KB I/zygote (11471): Increasing code cache capacity to 256KB I/flutter (11471): time span = 934 ms I/flutter (11471): time span = 6012 ms I/flutter (11471): time span = 954 ms
THIRD TEST geolocator: ^5.1.4 (WHITOUT await in geolocator pressing button 10 times quick Launching lib/main.dart on Moto Z2 Play in debug mode... Initializing gradle... Resolving dependencies... Running Gradle task 'assembleDebug'... Built build/app/outputs/apk/debug/app-debug.apk. Installing build/app/outputs/apk/app.apk... Syncing files to device Moto Z2 Play... I/flutter (16122): time span = 1020 ms I/flutter (16122): time span = 159 ms I/flutter (16122): time span = 584 ms I/flutter (16122): time span = 544 ms I/flutter (16122): time span = 99 ms I/flutter (16122): time span = 536 ms I/flutter (16122): time span = 82 ms I/zygote (16122): Do partial code cache collection, code=62KB, data=50KB I/zygote (16122): After code cache collection, code=62KB, data=50KB I/zygote (16122): Increasing code cache capacity to 256KB I/flutter (16122): time span = 504 ms I/flutter (16122): time span = 1381 ms I/flutter (16122): time span = 946 ms
While I didn't check the problem on Android myself, as the title states, this issue was opened for iOS. Nonetheless, your tests show pretty inconsistent results, and I'm not sure what the third test does without await on the geolocator call. Maybe posting your app's code would clarify that. In any case, I'm staying with the version 4.0.3 of the library for now. As a matter of fact I released my app on the apple store just recently. You might want to check it out at http://apps.apple.com/us/app/apple-store/id1469322424
Here is my test for IOS 12.4.4 iPhone 6
FIRST TEST geolocator: ^4.0.3 Launching lib/main.dart on iPhone PCB in debug mode... Signing iOS app for device deployment using developer identity: "iPhone Developer: Paulo Breim (Y34R2HBJ59)" Running pod install... Running Xcode build... Xcode build done. 23,7s Installing and launching... Syncing files to device iPhone PCB... flutter: time span = 230 ms flutter: time span = 92 ms flutter: time span = 74 ms flutter: time span = 80 ms flutter: time span = 95 ms flutter: time span = 87 ms flutter: time span = 199 ms flutter: time span = 58 ms flutter: time span = 73 ms flutter: time span = 70 ms
SECOND TEST geolocator: ^5.1.4 Launching lib/main.dart on iPhone PCB in debug mode... Signing iOS app for device deployment using developer identity: "iPhone Developer: Paulo Breim (Y34R2HBJ59)" Running pod install... Running Xcode build... Xcode build done. 22,6s Installing and launching... Syncing files to device iPhone PCB... flutter: time span = 12383 ms flutter: time span = 10033 ms flutter: time span = 10027 ms flutter: time span = 10026 ms flutter: time span = 10031 ms flutter: time span = 10029 ms flutter: time span = 10032 ms flutter: time span = 10032 ms flutter: time span = 10028 ms flutter: time span = 10029 ms
babaosoftware, let me know if you need more tests
@paulobreim thanks for your effort. Apparently confirms what we've been saying all along, and the results are consistent. Versions of geolocator library, starting with 5.0.0 have an unacceptable response time of about 10 seconds for calls to getCurrentPosition on iOS platform. The results on Android are inconsistent, but some show response times of over 8 seconds, which is also worrisome. @StijnWoerkom I think there's enough evidence that something is very wrong with the library upgrade and requires some effort to isolate and fix.
@babaosoftware Thank you for your effort. I tested the same issue and came to the same conclusion as you did. We will work on this issue and keep you posted when there is a solution to this issue.
Same happening here on iOS 13.1.3 iPhone XR with latest version of GeoLocator. It takes between 8-10 seconds to get current position
For those of you who have trouble with slow getPosition
in iOS (e.g. takes 10+s to get position information), you can use this alternative package as it has been said before in the earlier thread.
https://github.com/Lyokone/flutterlocation
It loads position information extremely fast both in Android as well as in iOS. (<1s).
I'm experiencing the same lag using the latest version. Are there any issues/down sides with sticking with version 4.0.3?
I agree with @cielo, I tested this package and the location package [link] and the difference in speed is apparent. Though, this package offers more features and I hope this bug in delay gets fixed (for me it's inconsistent).
I just want to add in that I'm still experiencing this slowness too. Works fine on the emulator, but takes more than 10 seconds on Physical Iphone 8 Plus device.
effectively version 4.0.3 works great. My experience in physical ios devices, with version 5.2.0, was very delayed in locating the location of the device, by lowering it to 4.0.3 the problem of solving
Hi, I am having this issue on Android
my code is as simple as. Position position = await _geoLocator.getCurrentPosition();
I am using a Google Pixel 3A
me too :( i'm using ^5.1.5 getCurrentPosition() so slow both Android, IOS
me too iam using ^5.3.0 IOS 12.4 Iphone 5s.
I have same problem, on iOS 13.4 beta iPhone XR Works fine on any android OS devices.
same issue still, works fine on the virtual device but 10 sec delay on physical device
Experiencing the same issue on my iPhone 7, iOS 13.4
Same issue in iPhone 7 and IPhone X, IOS 13
Hello, same issue in a real iPhone X device, iOS 13
Our startup time was 10+ seconds because of this issue, going back to 4.0.3 works
Same here, iPhone 5s iOS 12.4.
Also in iPhone 6s iOS 13.4
I'm experiencing this issue as well. iPhone 6s iOS 13.4
Same problem on a physical device, iPhone 8 iOS 13.4. getLastKnownLocation
works fine.
+1
Same here using ^5.3.1
Geolocator's version on iPhone Xs and iOS 13.3. I've downgraded it to 4.0.3
and its very fast! 🚀
Having same slowly results, in the IOS simulator it works like a charm, then I tried on real phone an takes about 10 seconds on every different address, I walked around few houses and the first time is always slow, if you retry then it loads fast.
I also tried 4.0.3 and is working fine, but I see many fixes from 4.0.3 to ^5.3.1. any plan to fix this up in the main branch?
I noticed 4.0.3 is not as accurate as 5.3.1
I also had this same issue. Downgrading to 4.0.3 resolved the issue for me. It worked fine on the ios simulator but was taking an age on my physical ios device (iPhone SE 2nd Gen).
How has this issue not gained more traction? Surely this is a production level plugin breaking issue. It simply can't be used in a live environment past v4.0.3.
Reproes here as well, iPhone 8. First acquisition is 20+ seconds on actual hardware on 5.3.1. Same hardware, same location, first acquisition is ~2 secs on 4.0.3.
Having same slowly results, in the IOS simulator it works like a charm, then I tried on real phone an takes about 10 seconds on every different address, I walked around few houses and the first time is always slow, if you retry then it loads fast.
Guy I have used 4.0.3 version for best result in simulator and device iOS (iPhone 6s - 8)
I have same issue and moving to 4.0.3 was not simple because I would have to back-down versions and I have already upgraded to Androidx. I used the flutter location plugin instead, much faster.
getCurrentPosition is working really fine on Android, but on IOS it took so much time to execute. Can you check it? Thank you Platform: