Closed shuaihuadu closed 8 years ago
It timed out, you can increase your timeout and make sure to wrap in a try/catch statement.
@jamesmontemagno Even if I set for 30 minutes, it's still threw an exception.
Same issue here! Help!
Are you checking on actual device or simulator? It throws this exception only on simulator. On an actual device its working fine.
I haven not had any issues on Visual Studio emulators for Android, Xamarin Android player, or google emulators. Make sure the emulator support it.
thanks jamesmontemagno,,you make a great plugin......but i met the same issue on my phone.....but i can get my position while use google map.
I have the same problem, it was working for a pair of hours. but now I can't make it work.
Plese helpppp..
Had the same problem here. I thought some devices were ok, some devices not ok. So I restarted the device that was not OK to my surprise then it worked. I ignore what is going on though
I have same issue, even in physical device. Some times works, some times not. The most important is that I'm not able to catch the error and continue the program, it just crash the app (I'm new on xamarin and mobile development).
Same problem on the emulator...
geolocator crash everytime on android 5.1.1.
Same problem here. Any solution found yet?
If you use an emulator you have to click the send location in the settings each time of the google emulator. It doesn't cache the actual location.
Hey James, your efforts in creating plugins are really of help. This issue might not be from the plugin nor from Xamarin but I found this android issue. This issue is open since 2013, and there was no solid solution for the same here is the link: "onLocationChanged" is not called(LocationManager using Network Provider) Still if anyone comes up with some work around for the same, it would be great, cause one of our testing teams device is trapped under this situation 😫 .
Same problem here. Version 5.0.0-beta124
same problem here. did anyone find solution please post here.
<uses-feature android:name="android.hardware.location.gps" />
<uses-feature android:name="android.hardware.location.network" />
Adding this in my mainfest.xml and increase timeout like 30 seconds solved my problem
I banged my head for a while on this issue. To solve this, catch the taskCanceledException. When you get this, ask the user to open Google Map, to locate the device then to come back in the app.
@DanielEnid this worked for me, i only opened google maps and go back to the app and everything has worked fine
Please take a moment to fill out the following (change to preview to check or place x in []) and remove all unused areas
This is a
Which plugin does this impact:
Bug
Version Number of Plugin:Xam.Plugin.Geolocator.3.0.4 Device Tested On:Android 4.4 Simulator Tested On:Android 4.4
Expected Behavior
Get current location.
Actual Behavior
Get an error : A task was canceled.
Steps to reproduce the Behavior
Code:
var locator = CrossGeolocator.Current;
if (locator.IsGeolocationAvailable && locator.IsGeolocationEnabled)
{
locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(timeoutMilliseconds: 10000);
CurrentLocation = new LocationModel
{
Name = Constants.CURRENT_LOCATION,
Latitude = position.Latitude,
Longitude = position.Longitude
};
}
Error Message:
A task was canceled.
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0002d] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:193 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable 1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:580 at Plugin.Geolocator.GeolocatorImplementation+<GetPositionAsync>d__27.MoveNext () [0x00597] in C:\projects\xamarin-plugins\Geolocator\Geolocator\Geolocator.Plugin.Android\GeolocatorImplementation.cs:175 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00027] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:190 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:170 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:142 at System.Runtime.CompilerServices.TaskAwaiter 1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3053/a94a03b5/source/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:372