Geolocation positionchanged event -- 0,0 coordinates

0
0

I have a form with a Geolocation control. When I browse on a mobile device, the first PositionChanged has 0,0 for coordinates.  On a desktop browser, it returns coordinates. Any reason why this would be?  I do have location services turned on , on the mobile device (Android 5.0).

Andrew

  • You must to post comments
0
0

The sample code doesn’t really do anything, it’s just this:

namespace Wisej.GeoLocationTest
{
 public partial class Page1 : Page
 {
 public Page1()
 {
 InitializeComponent();
 }

private void button1_Click(object sender, EventArgs e)
 {
 this.geolocation.GetCurrentPosition((l) => {

this.label1.Text = l.ToString();

});
 }


private void checkBox1_CheckedChanged(object sender, EventArgs e)
 {
 this.geolocation.ActiveWatch = this.checkBox1.Checked;
 }

private void geolocation_PositionChanged(object sender, EventArgs e)
 {
 this.label2.Text = this.geolocation.LastPosition.ToString();
 }
 }
}

I don’t know what caused the error you see. It’s strange that it mentions a link to googleapis. It’s possible that the browser is using google apis to geolocate. Weird. See this: https://stackoverflow.com/questions/41137594/network-location-provider-at-https-www-googleapis-com-returned-error-code

There are many posts with the same error.

 

  • You must to post comments
0
0

Now I can’t get Chrome to work at all. Right now I’m getting this from your test site on Chrome — Firefox works.

In my project, I can see “PositionUnavailable”, but not the same details that https://wisejgeolocationtest.azurewebsites.net provides. Is the source available ?

 

 

  • You must to post comments
0
0

Yes, it seems to work now provided it is always Https.  It seems that’s a feature introduced in Chrome 50 — need SSL for Geolocation. I’ll probably just use Firefox while debugging geolocation routines on mobile.  Thank you for the help.

  • You must to post comments
0
0

You can retrieve the Status property of the Position parameter passed to GetCurrentPosition() or using the LastPosition property.

It returns one of the Wisej.Ext.Geolocation.StatusCode values.

It works with https?

 

  • You must to post comments
0
0

Yes, works on desktop, on mobile it didn’t fire because I didn’t append https:”PermissionDeniedError” “Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).

This would explain some of the behavior I’m getting. After clearing Chrome settings on desktop and mobile.

— I can get localhost to display the location request pop-up

— I can get the production site to display the location request pop-up (with HTTPS)

— the alias site that goes to the dev machine does not display a pop-up request. (no HTTPS)

 

In your demo, that status information (PermissionDenied) would be useful — is that available as a member of the Geolocation object?

thanks,

Andrew

 

“https://github.com/RocketChat/Rocket.Chat/issues/3202”

“https://www.chromium.org/Home/chromium-security/prefer-secure-origins-for-powerful-new-features”

 

 

  • You must to post comments
0
0

Did you try this? https://wisejgeolocationtest.azurewebsites.net/

I’ll see if I can get hold of Chrome Mobile 59.0.3071.125

  • You must to post comments
0
1

Thanks for that. It’s not the browser, because I can get other sites to generate the pop-up “xxxxxx wants to know your location (Allow/Block)”.  I can’t get WiseJ to generate that on Chrome Mobile 59.0.3071.125 (Android 5.0.1).  It doesn’t matter if I have the Timeout property set to -1 or 10000.  I also checked Chrome’s Location settings to make sure the URL was not blocked.

The PositionChanged event does fire, however… but it’s always null coordinates.

  • You must to post comments
0
0

Don’t know. We use the browser’s geolocation. Look at this thread, there are a couple of links to test apps. There was a problem with older iPhone devices that we fixed:

https://wisej.com/support/question/iphone-geolocation

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.