Receiving GPS Location take too much time on windows phone

2317
8
05-30-2018 07:51 AM
Haider_AliFaheem
New Contributor II

Hello Everyone,

i am testing to receive GPS point on Mobile Application on different windows phone(Lumia 550.Lumia 640,Lumia 740 XL) and it is  taking nearly a minute to capture the GPS location.

i also tested following sample from esri and it also have the same behavior.

arcgis-runtime-samples-dotnet/src/Forms/Shared/Samples/Location/DisplayDeviceLocation at master · Es... 

i run the same sample on android and iOS and it is working fine and receive the GPS point in couple of seconds.

why it is taking too much time only on Windows phone.is it the issue of windows Native Api or some ArcGIS runtime have some checks which don't allow signal with low accuracy or something.

Windows OS version 10.0.14393, 10.0.15063

ArcGIS Runtime SDk for Xamarin 100.2.1

Thanks

Haider

0 Kudos
8 Replies
dotMorten_esri
Esri Notable Contributor

The location service relies on the phone's location APIs to provide a location. Do you see the same long delay when using the built-in maps app? Is the phone connected online, does it have a clear view of the sky etc?

0 Kudos
Haider_AliFaheem
New Contributor II

Morten thanks for the reply,yes i checked the built in maps app and there is no delay as soon i click on the gps but map app show the location and zoom to that location and location is also very accurate

0 Kudos
dotMorten_esri
Esri Notable Contributor

Thanks for confirming. To try and pinpoint what's going on, is it always an entire minute, or only the first time you load the app (ie if you shut the app down after getting a location and start back up immediately, it _should_ be faster) ?

Also if you're moving/walking outside, will it show up faster?

0 Kudos
Haider_AliFaheem
New Contributor II

no it is everytime take very long ,even if map activity close and open it again.after getting the gps location first time if you disable the LocationDisplay and Start again then it is immediate without closing the form then it is immediate

0 Kudos
dotMorten_esri
Esri Notable Contributor

...and if you're actively moving? (I'm theorizing that the issue is that the first initial location update is ignored, and if you aren't moving it could be a while before it will trigger another location update)

Also you could try and duplicate what the location datasource does with this code and see what happens?

var locator = new Geolocator()
{
    DesiredAccuracy = PositionAccuracy.High,
    MovementThreshold = 0,
    ReportInterval = 1000,
};
var position = await locator.GetGeopositionAsync(TimeSpan.FromHours(1), TimeSpan.FromMinutes(1)); //How long does this take?
locator.PositionChanged += (s,e) {
   // how long before this event triggers?
   System.Diagnostics.Debugger.Break();
};

Another thing you could try is using the location datasource that location display is using directly:

var ds = new SystemLocationDataSource();
ds.LocationChanged += (s,e) =>
{
     // how long before this event triggers?
     System.Diagnostics.Debugger.Break();
}
await ds.StartAsync(); //How long does this one take?
0 Kudos
RalfSchmidt
New Contributor III

Hi Morten,

Haider is working in the same team as I do. Thanks for sharing this piece of source code with us. For me that clearifies pretty much what our problem is. According to https://docs.microsoft.com/en-us/uwp/api/windows.devices.geolocation.geolocator.desiredaccuracy the setting 

DesiredAccuracy = PositionAccuracy.High

is the same as setting the Accuracy to "10 meters". Which is probably more accurate than other applications want their location to be. We already have a custom LocationDatasource attached to the MapView that currently internally uses the SystemLocationDataSource. I think we change this to use Geolocator class directly and use an Accuracy of maybe about 40 meters. That way the location events should start to appear earlier.

Ralf

0 Kudos
dotMorten_esri
Esri Notable Contributor

Since it's Desired and not Required accuracy, the location updates should still come back quick. It really just means "hey also turn on the GPS". If you don't set it, it won't turn on the GPS and just base the location on cell-tower/wifi/ip. But initially you should be getting celltower or wifi based locations until the GPS starts getting a signal. At least that's what I'm observing is happening on my devices.

Btw, I love that you're using Windows Phone (I miss my Windows phone). But please be aware that the next update of the runtime will move to require minimum 16299 for the UWP SDK, which means most Windows Phones won't be able to run it. So you might be stuck on 100.2.1 unless you move to Xamarin Android/iOS or a Windows 10 Tablet.

0 Kudos
RalfSchmidt
New Contributor III

I found out why we didn't get a location in the beginning. Morten, you wrote: "But initially you should be getting celltower or wifi based locations until the GPS starts getting a signal." That's exactly the point. Since our test device did not have a SIM card I assume it is not able to provide a position based on cell tower.

We solved our issue by simply switching on the SystemLocationDatasource earlier then we need it. However, most users will have a SIM card anyway and will not run into the issue.

0 Kudos