使用webview打开网页,遇到需要定位时,可以这样设置
前提是需要先获取到定位权限
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!");
}
}