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

[Bug]: TimeoutException after 0:00:10.000000: Future not completed

Open jenilAipxperts opened this issue 1 year ago • 26 comments

Please check the following before submitting a new issue.

Please select affected platform(s)

  • [X] Android
  • [ ] iOS
  • [ ] Linux
  • [ ] macOS
  • [ ] Web
  • [ ] Windows

Steps to reproduce

Use the getCurrentPosition method with the following code: userPositionData = await Geolocator.getCurrentPosition( locationSettings: LocationSettings( accuracy: LocationAccuracy.high, distanceFilter: 10, timeLimit: const Duration(seconds: 10), ));

I don't want a limit I want to connect the user's location in my app but on an Android Redmi(Android 13) device it will not get the user's current location

Expected results

want to connect in every device

Actual results

I do not want to timeout my app content force location tracking so for this issue my app was stuck

Code sample

userPositionData = await Geolocator.getCurrentPosition( locationSettings: LocationSettings( accuracy: LocationAccuracy.high, distanceFilter: 10, timeLimit: const Duration(seconds: 10), ));

Screenshots or video

Screenshots or video demonstration

[Upload media here]

Version

geolocator: ^13.0.2

Flutter Doctor output

flutter --version Flutter 3.24.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision dec2ee5c1f (12 days ago) • 2024-11-13 11:13:06 -0800 Engine • revision a18df97ca5 Tools • Dart 3.5.4 • DevTools 2.37.3

jenilAipxperts avatar Nov 25 '24 11:11 jenilAipxperts

I got this error in my app. The future has not been completed for a long time. If you fix the error, let me know.

temporary solution the error was in the ios simulator. I changed simulator location settings to custom location value and error fixed.

Ekran Resmi 2024-12-03 13 46 17

aarican1 avatar Nov 28 '24 19:11 aarican1

I’m experiencing the same issue when running on the iOS simulator. The location request doesn't seem to work as expected. Has anyone found a workaround or a potential fix for this?

br-programmer avatar Nov 29 '24 04:11 br-programmer

I’m experiencing the same issue when running on the iOS simulator. The location request doesn't seem to work as expected. Has anyone found a workaround or a potential fix for this?

Hello @br-programmer In iOS, I’m not facing any issues. Please verify it on a real device.

jenilAipxperts avatar Nov 29 '24 04:11 jenilAipxperts

image position = await _geolocatorPlatform .getCurrentPosition( locationSettings: const LocationSettings(timeLimit: Duration(seconds: 10))) .catchError((e) { });

Hi,I also had this problem on my android test machine, my realMe phone model: RMX 3357, android version: 13. It doesn't work. Also my vivo Y10, android version: 11, it doesn't work either. But it does work on the iOS. Please help to look at this question, because I have the same situation as the author of this question, thank you.

longzhenqi avatar Dec 02 '24 14:12 longzhenqi

@jenilAipxperts,

Please play around with the location settings, if you are testing indoor or outside would also generate different results. Try to lower the accuracy and distance filter first.

Kind regards,

TimHoogstrate avatar Dec 03 '24 10:12 TimHoogstrate

@TimHoogstrate Still facing same issue i tried low and lowest both but still I am getting same error

jenilAipxperts avatar Dec 03 '24 10:12 jenilAipxperts

@TimHoogstrate Any Update?

jenilAipxperts avatar Dec 12 '24 06:12 jenilAipxperts

@TimHoogstrate Any Update? do you have WeChat?We can add friends to communicate

longzhenqi avatar Dec 18 '24 06:12 longzhenqi

Same issue. My phone is IQOO 13 with android 15 from Vivo.

elethiame avatar Dec 20 '24 00:12 elethiame

Pixel 8 Android 14 Also can not get position with await Geolocator.getCurrentPosition(). Without timeLimit, await this means forever waiting. Im sure location service and permissions went well, and other app can locate my position immeditly. iOS works.

iwpz avatar Jan 03 '25 01:01 iwpz

mee too

lfclfc avatar Jan 03 '25 09:01 lfclfc

After some test, GMS phone can't get position in China, after I solved "network connection" problem, it works.

iwpz avatar Jan 07 '25 01:01 iwpz

经过一番测试,GMS手机在中国无法定位,解决“网络连接”问题后,就可以了。

这个是怎么解决的呢,我测试过华为、小米、还有其它机型,貌似只要没有Google服务的都不行

langyuxiansheng avatar Jan 09 '25 05:01 langyuxiansheng

I have the same situation as the author of this question

jupeng123 avatar Jan 13 '25 02:01 jupeng123

I have the same issue.
On devices such as iPhone, Xiaomi, and Huawei, Geolocator.getCurrentPosition can return the longitude and latitude normally. But on Vivo devices, the longitude and latitude cannot be obtained.

Aliffter avatar Feb 08 '25 06:02 Aliffter

@langyuxiansheng 解决了吗?

Aliffter avatar Feb 08 '25 07:02 Aliffter

这是因为geo用的谷歌地图,国内访问不了,你试试翻墙看看,翻墙应该是没有问题的。

猫吃小鱼干 @.***

 

------------------ 原始邮件 ------------------ 发件人: "Baseflow/flutter-geolocator" @.>; 发送时间: 2025年2月8日(星期六) 下午3:16 @.>; @.@.>; 主题: Re: [Baseflow/flutter-geolocator] [Bug]: TimeoutException after 0:00:10.000000: Future not completed (Issue #1611)

@langyuxiansheng 解决了吗?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

longzhenqi avatar Feb 08 '25 07:02 longzhenqi

@langyuxiansheng 解决了吗?

没有 解决不了。。。 安卓端,暂时用的是百度地图的定位SDK来处理的。

langyuxiansheng avatar Feb 08 '25 07:02 langyuxiansheng

这是因为geo用的谷歌地图,国内访问不了,你试试翻墙看看,翻墙应该是没有问题的。

猫吃小鱼干 @.***

 

但是正常用户谁会去翻墙呀。。。 大部分使用APP的用户可能都是普通用户,特别是国内的。

langyuxiansheng avatar Feb 08 '25 07:02 langyuxiansheng

我也遇到了 小米红米不行 华为和iOS可以

sanyuegirl avatar Mar 06 '25 09:03 sanyuegirl

Im getting this constantly on iOS on the second+ time opening the app. on the first time, the app prompts location permission. any other time it just hangs and if i add timeout, it fails with timeout error

eifr avatar Mar 06 '25 10:03 eifr

Adding <uses-permission android:name="android.permission.INTERNET" /> did it for me

cngeru avatar May 29 '25 03:05 cngeru

In China on android phone, still not working. But use native project method it can get position.

smallooo avatar Aug 04 '25 13:08 smallooo

In China on android phone, still not working. But use native project method it can get position.

Yes,only use native project method it can get position. in china

longzhenqi avatar Aug 04 '25 14:08 longzhenqi

这是因为geo用的谷歌地图,国内访问不了,你试试翻墙看看,翻墙应该是没有问题的。 猫吃小鱼干 @.***  

但是正常用户谁会去翻墙呀。。。 大部分使用APP的用户可能都是普通用户,特别是国内的。

你只能使用安卓原生去写,然后传给flutter了。我们是海外的项目,在国内开发,所以才需要翻墙

longzhenqi avatar Aug 04 '25 14:08 longzhenqi

Any package recommend if need use in China, except baidu and Amap, those are two heavy, only need to get location.

smallooo avatar Aug 06 '25 00:08 smallooo