i***@outlook.com
i***@outlook.com
  • 发布:2018-09-03 00:02
  • 更新:2020-06-26 16:34
  • 阅读:2415

[BUG] uniapp 的 webview的geolocation 无法获得位置

分类:uni-app

这个问题很常见,很明显的bug。国外也有人遇到,并且提出了解决方法。

原因:

the web browser will ask the user for permission to access his/her location.

This don’t automatically happen with a WebView since you have to handle this permission request the Android way in your code.

If your WebView has an associated WebChromeClient when a website attempts to use Geolocation API this will receive a notification via the method

onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback)
where origin is the origin of the web content that requested the permission and callback has the method to call to set the permission state, but no permission is yet set and no UI is displayed to the user.

请官方解决一下。
解决办法,如下:

https://medium.com/@xabaras/android-webview-handling-geolocation-permission-request-cc482f3de210

2018-09-03 00:02 负责人:无 分享
已邀请:
o***@gmail.com

o***@gmail.com

您好,这个问题您解决了吗? 我也遇到了。

https://medium.com/@xabaras/android-webview-handling-geolocation-permission-request-cc482f3de210
这个链接我打不开,是需要翻墙吗?我梯子刚好坏了。访问不了。

求指点。

该问题目前已经被锁定, 无法添加新回复