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

后端 未结 8 1243
萌比男神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 17:16

    Change your request for permission like this,

    ActivityCompat.requestPermissions(this, new String[]{
                Manifest.permission.ACCESS_FINE_LOCATION,
                Manifest.permission.ACCESS_COARSE_LOCATION
        },0);
    

    This seems to work.

提交回复
热议问题