I am using jxbrowser to integrate google maps in my java swing application on macos . But due to permission restriction I am not able to get the geolocation requested by the google maps . Below is my code .
Engine browserEngine = Engine.newInstance(EngineOptions.newBuilder(RenderingMode.HARDWARE_ACCELERATED)
.enableProprietaryFeature(ProprietaryFeature.WIDEVINE)
.enableProprietaryFeature(ProprietaryFeature.AAC)
.enableProprietaryFeature(ProprietaryFeature.H_264)
.googleApiKey("api-key")
.googleDefaultClientId("client-id")
.googleDefaultClientSecret("client-secret-id")
.licenseKey("jxbrowser license key")
.remoteDebuggingPort(9222)
.build());
browserEngine.permissions().set(RequestPermissionCallback.class, (params, tell) -> {
PermissionType type = params.permissionType();
System.out.println("Permission type is :"+type);
if (type == PermissionType.VIDEO_CAPTURE || type == PermissionType.AUDIO_CAPTURE) {
tell.grant();
} else {
System.out.println("Permission type is :"+type);
tell.grant();
System.out.println("Permission granted");
}
});
Browser browser = browserEngine.newBrowser();
browser.navigation().loadUrl("https://www.google.com/maps");
JFrame frame = new JFrame();
frame.setExtendedState(JFrame.MAXIMI
ZED_BOTH);
frame.add(BrowserView.newInstance(browser));
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
I need to solve this issue as soon as possible, I am stuck in this issue.
I just need to access the location , but i am not able to get the geolocation on macos . Same code is working well on windows .