Home > Back-end >  Is no resistance, XE write too little APP help. How about WEBBROWSER support LBS positioning problem
Is no resistance, XE write too little APP help. How about WEBBROWSER support LBS positioning problem

Time:09-25

In order to make the WEBVIEW open the map, map calls positioning, namely LBS function, this is the ANDROID native code, is in the XE, best not singular integral, tried a lot of ways, I don't know how to write,
WebView. GeeSettings. SetJavaScriptEnabled (true);
WebView. GetSettings. SetGeolocationEnabled (true);
WebView. GetSettings. SetJavaScriptCanOpenWindowsAutomatically (true);

WebView. SetWebChromeClient (new WebChromeClient () {

@ Override

Public void onGeolocationPermissionsShowPrompt (String origin,

Android. Its. GeolocationPermissions. Callback Callback) {

The callback invoke (origin, true, false);

Super. OnGeolocationPermissionsShowPrompt (origin, callback);

}

Above the android native JAVA writing,

And DELPHI XE, I try to rewrite FMX WebBrowser. Android, add the following code at InitUIThread, but will not trigger event onGeolocationPermissionsShowPrompt what, do not know to have a friend to solve the problem, solve the problem, can use the WEB use. Such as.net program calls baidu, tencent and other positioning function, the function of LBS!
FJWebBrowser. GetSettings. SetJavaScriptCanOpenWindowsAutomatically (true);
FJWebBrowser. GetSettings. SetGeolocationEnabled (true);
FJWebBrowser. GetSettings. SetDomStorageEnabled (true);

FJWebChromeClient:=TJWebChromeClientEx. Create;
FJWebBrowser. SetWebChromeClient (FJWebChromeClient);


TJWebChromeClientEx=class (TJWebChromeClient)
Public
Procedure onGeolocationPermissionsShowPrompt (origin: JString;
The callback: JGeolocationPermissions_Callback); Cdecl;
end;

Procedure TJWebChromeClientEx. OnGeolocationPermissionsShowPrompt
(origin: JString; The callback: JGeolocationPermissions_Callback);
The begin
The callback invoke (origin, true, False);
Inherited;
end;
  • Related