So we have a total of three Android devices that we’re testing with. One of them, a Galaxy S8, has the camera out of focus and refuses to focus properly. The other two are working fine, including a Galaxy S9+ and a Samsung Galaxy Tab A 10.1. I added a camera focus fix, just to make sure the camera was in autofocus mode, but it didn’t help. I saw that in some other forum posts. Here’s the code that I used for that:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class CameraFocusFix : MonoBehaviour {
private bool vuforiaStarted;
private void Start() {
if (VuforiaARController.Instance != null)
VuforiaARController.Instance.RegisterVuforiaStartedCallback(fixFocus);
}
private void fixFocus() {
vuforiaStarted = true;
setAF();
}
private void onAppPause(bool paused) {
if (!paused) {
if (vuforiaStarted) {
setAF();
}
}
}
private void setAF() {
Debug.Log("Fixing focus");
CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
}
}
The debug statement on line 41 shows up, so the code is running, but the one device is still out of focus. The camera works fine when using the built-in camera app - just not in AR. We have another app that works perfectly on all three devices, so I also tried making all of the player settings and Vuforia settings identical. That didn’t do it either. And yes, we tried restarting the phone, too. It’s the same APK on all three devices.
Can anyone help?