Build for Android
Unreal implements bindings for native Android webview, but those bindings are limited. There are two issues that may appear:
- Camera does not open up because permissions are not granted.
- Sign in with email/Google does not work (if you are using Avaturn API, you won't have this issue).
To fix this, we need to change java files in the in engine directory. It's not possible to ship those fixes as a part of SDK or example so the fixes should be applied manually. Please find below the steps to solve those problems.
Find the file
- Go to Unreal Engine folder to
- Open Java file -
- Find the definition of
See below how to change this file to fix the issues.
Making camera work
webView.setWebChromeClient(new ChromeClient()) with
public void onPermissionRequest(final PermissionRequest request)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
Note that you need to request and get camera permission for the app before using the camera in webview.
We need to change
User-Agent, we use Firebase and it does not want to work with the default one. There is no straightforward way to set user agent through the API.
We need to hard-code the
WebViewControl.java. After the lines
webView.getSettings().set.. add the following row to set User-Agent:
'Mozilla/5.0 (Linux; Android 12) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.5359.128 Mobile Safari/537.36'