1

I created a Phonegap project and I was testing it using Phonegap Desktop.

In the project I'm using Geolocation API.

In Chrome I'm getting

getCurrentPosition() and watchPosition() are deprecated on insecure origins. To use this feature, you should consider switching your application to a secure origin, such as HTTPS. See https://sites.google.com/a/chromium.org/dev/Home/chromium-security/deprecating-powerful-features-on-insecure-origins for more details.

How can I configure Phonegap Desktop to make this work? What do I have to do make it work on an actual mobile?

I already added in config.xml:

<feature name="http://api.phonegap.com/1.0/geolocation"/>
Adrian Ber
  • 20,474
  • 12
  • 67
  • 117

2 Answers2

2

Apparently, Chrome doesn't support Geolocation API without using HTTPS.

You might have to preview your App using the PhoneGap Developer (Mobile) App.

This previous thread states that the Geolocation API should work fine on mobile.

Community
  • 1
  • 1
Herm Wong
  • 73
  • 6
  • Actually I discovered that you can still use Phonegap Desktop. Chrome does support Geolocation API without HTTPS for localhost. So you have to access Phonegap Desktop like http://localhost:3000, instead of using the API. – Adrian Ber Jun 02 '16 at 10:11
1

I discovered that you can still use Phonegap Desktop, but instead of using the IP displayed on the server location, use localhost, like http://localhost:3000. Chrome does support Geolocation API without HTTPS for localhost.

Then on the device everything is working fine.

Adrian Ber
  • 20,474
  • 12
  • 67
  • 117