navigator.geolocation.getCurrentPosition() never returns in WebView on Android

后端 未结 8 1266
萌比男神i
萌比男神i 2021-02-18 16:27

I am trying to access the HTML Geolocation API available in Android WebView (using SDK version 24).

The main problem is that the call to navigator.geolocat

8条回答
  •  星月不相逢
    2021-02-18 16:59

    I experienced this problem on Android 8. The error callback was called with error.code==1 "PERMISSION_DENIED".

    https://developers.google.com/web/updates/2016/04/geolocation-on-secure-contexts-only Geolocation API Removed from Unsecured Origins in Chrome 50

    Meaning, the URL of your app must begin with https:// for the call to work.

提交回复
热议问题