Harmony鸿蒙Webview定位的问题
使用webview打开网页,遇到需要定位时,可以这样设置前提是需要先获取到定位权限webView.setBrowserAgent(new locationRec(this));private class locationRec extends ohos.agp.components.webengine.BrowserAgent{public locationRec(Context context)
·
使用webview打开网页,遇到需要定位时,可以这样设置
前提是需要先获取到定位权限
webView.setBrowserAgent(new locationRec(this));
private class locationRec extends ohos.agp.components.webengine.BrowserAgent{
public locationRec(Context context) {
super(context);
}
@Override
public void onLocationApiAccessRequest(String origin, LocationAccessController.Response response) {
response.apply(origin,true,false);
super.onLocationApiAccessRequest(origin, response);
//throw new RuntimeException("Stub!");
}
}
更多推荐


所有评论(0)